Spaces:
Runtime error
Runtime error
Jiedong Yang
commited on
Commit
β’
09182d9
1
Parent(s):
18d2fb0
Upload app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import time
|
3 |
import whisper
|
4 |
import validators
|
@@ -27,6 +28,7 @@ def audio_from_url(url, dst_dir='data', name=None, format='wav'):
|
|
27 |
os.makedirs(dst_dir, exist_ok=True)
|
28 |
|
29 |
# download audio
|
|
|
30 |
path = os.path.join(dst_dir, f"audio.{format}")
|
31 |
if os.path.exists(path):
|
32 |
os.remove(path)
|
@@ -107,6 +109,10 @@ with demo:
|
|
107 |
|
108 |
url.change(audio_from_url, inputs=url, outputs=speech)
|
109 |
|
|
|
|
|
|
|
|
|
110 |
# ASR
|
111 |
text = gr.Textbox(label="Transcription", placeholder="transcription")
|
112 |
|
@@ -133,10 +139,7 @@ with demo:
|
|
133 |
image = gr.Image(label="wordcloud", show_label=False).style(height=400, width=400)
|
134 |
|
135 |
text.change(wordcloud_func, inputs=text, outputs=image)
|
136 |
-
|
137 |
-
examples = gr.Examples(examples=["https://www.youtube.com/watch?v=DuX4K4eeTz8",
|
138 |
-
"https://www.youtube.com/watch?v=nepOSEGHHCQ"],
|
139 |
-
inputs=[url])
|
140 |
|
141 |
if __name__ == '__main__':
|
142 |
demo.launch()
|
|
|
1 |
import os
|
2 |
+
import pafy
|
3 |
import time
|
4 |
import whisper
|
5 |
import validators
|
|
|
28 |
os.makedirs(dst_dir, exist_ok=True)
|
29 |
|
30 |
# download audio
|
31 |
+
# video = pafy.new(url)
|
32 |
path = os.path.join(dst_dir, f"audio.{format}")
|
33 |
if os.path.exists(path):
|
34 |
os.remove(path)
|
|
|
109 |
|
110 |
url.change(audio_from_url, inputs=url, outputs=speech)
|
111 |
|
112 |
+
examples = gr.Examples(examples=["https://www.youtube.com/watch?v=DuX4K4eeTz8",
|
113 |
+
"https://www.youtube.com/watch?v=nepOSEGHHCQ"],
|
114 |
+
inputs=[url])
|
115 |
+
|
116 |
# ASR
|
117 |
text = gr.Textbox(label="Transcription", placeholder="transcription")
|
118 |
|
|
|
139 |
image = gr.Image(label="wordcloud", show_label=False).style(height=400, width=400)
|
140 |
|
141 |
text.change(wordcloud_func, inputs=text, outputs=image)
|
142 |
+
|
|
|
|
|
|
|
143 |
|
144 |
if __name__ == '__main__':
|
145 |
demo.launch()
|