This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from phonemizer import phonemize | |
text = ["Hello, world!", "Welcome to Medium!"] | |
phonemized = phonemize(text, language='en-us', backend='espeak') | |
print(phonemized) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import glob | |
import os | |
import shutil | |
def copyfiles(fil, root_dir): | |
basename = os.path.basename(fil) | |
filename = os.path.splitext(basename)[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw | |
def yolo_to_xml_bbox(bbox, w, h): | |
# x_center, y_center width heigth | |
w_half_len = (bbox[2] * w) / 2 | |
h_half_len = (bbox[3] * h) / 2 | |
xmin = int((bbox[0] * w) - w_half_len) | |
ymin = int((bbox[1] * h) - h_half_len) | |
xmax = int((bbox[0] * w) + w_half_len) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
import glob | |
import os | |
import json | |
def xml_to_yolo_bbox(bbox, w, h): | |
# xmin, ymin, xmax, ymax | |
x_center = ((bbox[2] + bbox[0]) / 2) / w | |
y_center = ((bbox[3] + bbox[1]) / 2) / h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<annotation> | |
<folder>pills</folder> | |
<filename>medical_pills.jpg</filename> | |
<path>C:\Users\wfng\pills\medical_pills.jpg</path> | |
<source> | |
<database>Unknown</database> | |
</source> | |
<size> | |
<width>626</width> | |
<height>417</height> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
id = "xxxxxx" | |
api_key = "xxxxxx" | |
endpoint = f"https://api.assemblyai.com/v2/transcript/{id}" | |
headers = { | |
"authorization": api_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
api_key = "xxxxxx" | |
endpoint = "https://api.assemblyai.com/v2/transcript" | |
data = { | |
"audio_url": "https://cdn.assemblyai.com/upload/d04b8505-3cf2-422a-a6e9-b9c6af7c8c6c", | |
"redact_pii": True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"iab_categories_result": { | |
"status": "success", | |
"results": [ | |
{ | |
"text": "Now to some breaking news because there were two separate school shootings this afternoon in Virginia. Two campus police officers were shot and killed at Bridgewater College that's located about 140 miles west of Washington, DC. A suspect has been taken into custody and no further details have been released. Nine different agencies, including the FBI, state police and campus police, have all responded to the scene. All right. Now there's this, too.", | |
"labels": [ | |
{ | |
"relevance": 0.005532493349164724, | |
"label": "NewsAndPolitics>Disasters" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
id = "o67inksqg3-b292-4e8f-adf1-5f52b04bbff2" | |
api_key = "xxxxxx" | |
endpoint = f"https://api.assemblyai.com/v2/transcript/{id}" | |
headers = { | |
"authorization": api_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
api_key = "xxxxxx" | |
endpoint = "https://api.assemblyai.com/v2/transcript" | |
data = { | |
"audio_url": "https://cdn.assemblyai.com/upload/d04b8505-3cf2-422a-a6e9-b9c6af7c8c6c", | |
"iab_categories": True |