Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,17 +31,32 @@ def text_to_speech(text,language):
|
|
31 |
lang = language_dict[language]
|
32 |
gTTS(text,lang,slow=False)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
fn=transcribe_audio,
|
38 |
inputs=[
|
39 |
gr.Audio(source="microphone", type="filepath", label="Transcribe from Microphone"),
|
40 |
gr.Dropdown(["English","Spanish","Dutch","French","Italian"], value="English", label="Translate to ")
|
41 |
],
|
42 |
outputs="text",
|
43 |
-
title=
|
44 |
-
description="Realtime demo for Swedish speech recognition with translation using a fine-tuned Whisper small model"
|
45 |
-
|
|
|
|
|
46 |
|
47 |
iface.launch()
|
|
|
31 |
lang = language_dict[language]
|
32 |
gTTS(text,lang,slow=False)
|
33 |
|
34 |
+
def transcribe_video(URL):
|
35 |
+
video = Youtube(URL)
|
36 |
+
yt = video.streams.get_audio_only()
|
37 |
+
yt.download()
|
38 |
+
text = pipe(yt)["text"]
|
39 |
+
return text
|
40 |
+
|
41 |
+
youtube_func = gr.Interface(
|
42 |
+
fn = transcribe_video,
|
43 |
+
inputs = "text",
|
44 |
+
outputs = "text",
|
45 |
+
title = "Whisper Small Swedish",,
|
46 |
+
description = "Realtime demo for Swedish speech recognition with translation using a fine-tuned Whisper small model",
|
47 |
+
)
|
48 |
|
49 |
+
transcribe_func = gr.Interface(
|
50 |
+
fn=transcribe_audio,
|
|
|
51 |
inputs=[
|
52 |
gr.Audio(source="microphone", type="filepath", label="Transcribe from Microphone"),
|
53 |
gr.Dropdown(["English","Spanish","Dutch","French","Italian"], value="English", label="Translate to ")
|
54 |
],
|
55 |
outputs="text",
|
56 |
+
title=Whisper Small Swedish",,
|
57 |
+
description="Realtime demo for Swedish speech recognition with translation using a fine-tuned Whisper small model",
|
58 |
+
|
59 |
+
|
60 |
+
iface = gr.TabbedInterface([transcribe_func, youtube_func], ["Audio to Text","Video transciption"])
|
61 |
|
62 |
iface.launch()
|