Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -40,27 +40,53 @@ description = """
|
|
40 |
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in Multilanguage to target speech in Chinese(mandarin). Demo uses OpenAI's [Whisper arge-v2](https://huggingface.co/openai/whisper-large-v2) model for speech translation, and a suno/bark[bark-small](https://huggingface.co/suno/bark) model for text-to-speech:
|
41 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
42 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
import gradio as gr
|
44 |
demo = gr.Blocks()
|
45 |
|
46 |
-
|
47 |
-
fn=
|
48 |
-
inputs=
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
50 |
title=title,
|
51 |
description=description,
|
|
|
|
|
52 |
)
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
with demo:
|
64 |
-
gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
|
|
|
65 |
|
66 |
demo.launch(share=True)
|
|
|
40 |
Demo for cascaded speech-to-speech translation (STST), mapping from source speech in Multilanguage to target speech in Chinese(mandarin). Demo uses OpenAI's [Whisper arge-v2](https://huggingface.co/openai/whisper-large-v2) model for speech translation, and a suno/bark[bark-small](https://huggingface.co/suno/bark) model for text-to-speech:
|
41 |
![Cascaded STST](https://huggingface.co/datasets/huggingface-course/audio-course-images/resolve/main/s2st_cascaded.png "Diagram of cascaded speech to speech translation")
|
42 |
"""
|
43 |
+
examples = [
|
44 |
+
["/mama (1).mp3", None],
|
45 |
+
["/mama (2).mp3", None],
|
46 |
+
["/mama (3).mp3", None],
|
47 |
+
["/mama (4).mp3", None],
|
48 |
+
["/mama (5).mp3", None],
|
49 |
+
["/mama (6).mp3", None],
|
50 |
+
["/mama (7).mp3", None],
|
51 |
+
["/mama (8).mp3", None],
|
52 |
+
]
|
53 |
import gradio as gr
|
54 |
demo = gr.Blocks()
|
55 |
|
56 |
+
Muti_translate=gr.Interface(
|
57 |
+
fn=peech_to_speech_translation_fix,
|
58 |
+
inputs=[
|
59 |
+
gr.Audio(label="Upload Speech", source="upload", type="numpy"),
|
60 |
+
gr.Audio(label="Record Speech", source="microphone", type="numpy"),
|
61 |
+
],
|
62 |
+
outputs=[
|
63 |
+
outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
64 |
+
],
|
65 |
title=title,
|
66 |
description=description,
|
67 |
+
article=article,
|
68 |
+
examples=examples,
|
69 |
)
|
70 |
|
71 |
+
# mic_translate = gr.Interface(
|
72 |
+
# fn=speech_to_speech_translation_fix,
|
73 |
+
# inputs=gr.Audio(source="microphone", type="filepath"),
|
74 |
+
# outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
75 |
+
# title=title,
|
76 |
+
# description=description,
|
77 |
+
# )
|
78 |
+
|
79 |
+
# file_translate = gr.Interface(
|
80 |
+
# fn=speech_to_speech_translation_fix,
|
81 |
+
# inputs=gr.Audio(source="upload", type="filepath"),
|
82 |
+
# outputs=gr.Audio(label="Generated Speech", type="numpy"),
|
83 |
+
# examples=examples,
|
84 |
+
# title=title,
|
85 |
+
# description=description,
|
86 |
+
# )
|
87 |
|
88 |
with demo:
|
89 |
+
# gr.TabbedInterface([mic_translate, file_translate], ["Microphone", "Audio File"])
|
90 |
+
gr.TabbedInterface([Muti_translate], ["Record or upload your speech"])
|
91 |
|
92 |
demo.launch(share=True)
|