Spaces:
Build error
Build error
Commit
路
d8cd210
1
Parent(s):
bee8bb6
adding translation
Browse files
app.py
CHANGED
|
@@ -23,7 +23,8 @@ def transcribe(audio):
|
|
| 23 |
def youtube_transcribe(url):
|
| 24 |
yt = pt.YouTube(url)
|
| 25 |
stream = yt.streams.filter(only_audio=True).first()
|
| 26 |
-
audio = stream.download()
|
|
|
|
| 27 |
return transcribe(audio)
|
| 28 |
|
| 29 |
|
|
@@ -36,7 +37,7 @@ mic_interface = gr.Interface(
|
|
| 36 |
|
| 37 |
audio_interface = gr.Interface(
|
| 38 |
fn=transcribe,
|
| 39 |
-
inputs="
|
| 40 |
outputs=["text", "text"],
|
| 41 |
title="Transcribir y traducir audio",
|
| 42 |
)
|
|
@@ -48,7 +49,7 @@ video_interface = gr.Interface(
|
|
| 48 |
title="Transcribir y traducir audio",
|
| 49 |
)
|
| 50 |
|
| 51 |
-
|
| 52 |
fn=youtube_transcribe,
|
| 53 |
inputs="text",
|
| 54 |
outputs=["text", "text"],
|
|
@@ -57,6 +58,6 @@ youtube_interface = gr.Interface(
|
|
| 57 |
|
| 58 |
if __name__ == "__main__":
|
| 59 |
gr.TabbedInterface(
|
| 60 |
-
[mic_interface, audio_interface, video_interface,
|
| 61 |
["Micr贸fono", "Audio", "Video", "YouTube"],
|
| 62 |
).launch()
|
|
|
|
| 23 |
def youtube_transcribe(url):
|
| 24 |
yt = pt.YouTube(url)
|
| 25 |
stream = yt.streams.filter(only_audio=True).first()
|
| 26 |
+
audio = stream.download(filename='youtube.mp4')
|
| 27 |
+
audio = whisper.load_audio(audio)
|
| 28 |
return transcribe(audio)
|
| 29 |
|
| 30 |
|
|
|
|
| 37 |
|
| 38 |
audio_interface = gr.Interface(
|
| 39 |
fn=transcribe,
|
| 40 |
+
inputs=gr.Audio(type="filepath"),
|
| 41 |
outputs=["text", "text"],
|
| 42 |
title="Transcribir y traducir audio",
|
| 43 |
)
|
|
|
|
| 49 |
title="Transcribir y traducir audio",
|
| 50 |
)
|
| 51 |
|
| 52 |
+
youtuve_interface = gr.Interface(
|
| 53 |
fn=youtube_transcribe,
|
| 54 |
inputs="text",
|
| 55 |
outputs=["text", "text"],
|
|
|
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
gr.TabbedInterface(
|
| 61 |
+
[mic_interface, audio_interface, video_interface, youtuve_interface],
|
| 62 |
["Micr贸fono", "Audio", "Video", "YouTube"],
|
| 63 |
).launch()
|