Spaces:
Runtime error
Runtime error
Commit
·
55edc68
1
Parent(s):
5ff5aa7
Update app.py
Browse files
app.py
CHANGED
@@ -48,20 +48,19 @@ description = '''Choose a sentence that describes audio the best if there's no s
|
|
48 |
audio_dir = 'AUDIO'
|
49 |
os.makedirs(audio_dir, exist_ok=True)
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
return audio_path, audio_url, sents
|
65 |
|
66 |
def audio_demo(cap, audio, annotator, audio_url):
|
67 |
annotator = annotator if annotator else str(uuid.uuid4())
|
|
|
48 |
audio_dir = 'AUDIO'
|
49 |
os.makedirs(audio_dir, exist_ok=True)
|
50 |
|
51 |
+
|
52 |
+
|
53 |
+
gc = gspread.service_account(filename='credentials.json')
|
54 |
+
sh = gc.open('Annotated CC Audio')
|
55 |
+
worksheet = sh.sheet1
|
56 |
+
df = pd.DataFrame(worksheet.get_all_records())
|
57 |
+
sample_df = df[df['caption']==''].sample(1)
|
58 |
+
|
59 |
+
url, audio_url, _, _, full_text, _, _ = sample_df.values[0]
|
60 |
+
audio_path = download_and_save_file(audio_url, audio_dir)
|
61 |
+
full_text = full_text.translate(str.maketrans('', '', string.punctuation))
|
62 |
+
sents = ['\n'.join(wrap(re.sub(r'###audio###\d###', '', s.text), width=70) )for s in nlp(full_text).sents]
|
63 |
+
sents.append('No audio description')
|
|
|
64 |
|
65 |
def audio_demo(cap, audio, annotator, audio_url):
|
66 |
annotator = annotator if annotator else str(uuid.uuid4())
|