Update app.py
Browse files
app.py
CHANGED
@@ -52,31 +52,31 @@ Demo for cascaded speech-to-speech translation (STST), mapping from source speec
|
|
52 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
53 |
"""
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
with gr.Blocks() as demo:
|
73 |
|
74 |
-
with gr.Row():
|
75 |
-
|
76 |
-
|
77 |
|
78 |
|
79 |
-
audio_in.stop_recording(speech_to_speech_translation, inputs=[audio_in], outputs=[audio_out])
|
80 |
-
|
81 |
|
82 |
demo.launch()
|
|
|
52 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
53 |
"""
|
54 |
|
55 |
+
mic_translate = gr.Interface(
|
56 |
+
fn=speech_to_speech_translation,
|
57 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
58 |
+
outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
59 |
+
title=title,
|
60 |
+
description=description,
|
61 |
+
)
|
62 |
+
|
63 |
+
file_translate = gr.Interface(
|
64 |
+
fn=speech_to_speech_translation,
|
65 |
+
inputs=gr.Audio(source="upload", type="filepath"),
|
66 |
+
outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
67 |
+
examples=[["./example.wav"]],
|
68 |
+
title=title,
|
69 |
+
description=description,
|
70 |
+
)
|
71 |
|
72 |
with gr.Blocks() as demo:
|
73 |
|
74 |
+
# with gr.Row():
|
75 |
+
# audio_in = gr.Microphone(label="Input audio", type="filepath")
|
76 |
+
# audio_out = gr.Audio(label="Output audio", type="numpy", autoplay=True)
|
77 |
|
78 |
|
79 |
+
# audio_in.stop_recording(speech_to_speech_translation, inputs=[audio_in], outputs=[audio_out])
|
80 |
+
gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
|
81 |
|
82 |
demo.launch()
|