Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
-
import librosa
|
3 |
from asr import transcribe, ASR_EXAMPLES, ASR_LANGUAGES, ASR_NOTE
|
4 |
-
from tts import synthesize, TTS_EXAMPLES, TTS_LANGUAGES
|
5 |
-
from lid import identify, LID_EXAMPLES
|
6 |
|
7 |
|
8 |
|
@@ -27,44 +24,6 @@ mms_transcribe = gr.Interface(
|
|
27 |
allow_flagging="never",
|
28 |
)
|
29 |
|
30 |
-
mms_synthesize = gr.Interface(
|
31 |
-
fn=synthesize,
|
32 |
-
inputs=[
|
33 |
-
gr.Text(label="Input text"),
|
34 |
-
gr.Dropdown(
|
35 |
-
[f"{k} ({v})" for k, v in TTS_LANGUAGES.items()],
|
36 |
-
label="Language",
|
37 |
-
value="eng English",
|
38 |
-
),
|
39 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=1.0, step=0.1, label="Speed"),
|
40 |
-
],
|
41 |
-
outputs=[
|
42 |
-
gr.Audio(label="Generated Audio", type="numpy"),
|
43 |
-
gr.Text(label="Filtered text after removing OOVs"),
|
44 |
-
],
|
45 |
-
examples=TTS_EXAMPLES,
|
46 |
-
title="Text-to-speech",
|
47 |
-
description=("Generate audio in your desired language from input text."),
|
48 |
-
allow_flagging="never",
|
49 |
-
)
|
50 |
-
|
51 |
-
mms_identify = gr.Interface(
|
52 |
-
fn=identify,
|
53 |
-
inputs=[
|
54 |
-
gr.Audio(),
|
55 |
-
],
|
56 |
-
outputs=gr.Label(num_top_classes=10),
|
57 |
-
examples=LID_EXAMPLES,
|
58 |
-
title="Language Identification",
|
59 |
-
description=("Identity the language of input audio."),
|
60 |
-
allow_flagging="never",
|
61 |
-
)
|
62 |
-
|
63 |
-
tabbed_interface = gr.TabbedInterface(
|
64 |
-
[mms_transcribe, mms_synthesize, mms_identify],
|
65 |
-
["Speech-to-text", "Text-to-speech", "Language Identification"],
|
66 |
-
)
|
67 |
-
|
68 |
with gr.Blocks() as demo:
|
69 |
gr.HTML(
|
70 |
"""
|
@@ -79,16 +38,13 @@ with gr.Blocks() as demo:
|
|
79 |
"<p align='center' style='font-size: 20px;'>MMS: Scaling Speech Technology to 1000+ languages demo. See our <a href='https://ai.facebook.com/blog/multilingual-model-speech-recognition/'>blog post</a> and <a href='https://arxiv.org/abs/2305.13516'>paper</a>.</p>"
|
80 |
)
|
81 |
gr.HTML(
|
82 |
-
"""<center>
|
83 |
-
)
|
84 |
-
gr.HTML(
|
85 |
-
"""<center>You can also finetune MMS models on your data using the recipes provides here - <a href='https://huggingface.co/blog/mms_adapters'>ASR</a> <a href='https://github.com/ylacombe/finetune-hf-vits'>TTS</a> </center>"""
|
86 |
)
|
87 |
gr.HTML(
|
88 |
"""<center><a href="https://huggingface.co/spaces/facebook/MMS?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank"><img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> for more control and no queue.</center>"""
|
89 |
)
|
90 |
|
91 |
-
|
92 |
gr.HTML(
|
93 |
"""
|
94 |
<div class="footer" style="text-align:center">
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from asr import transcribe, ASR_EXAMPLES, ASR_LANGUAGES, ASR_NOTE
|
|
|
|
|
3 |
|
4 |
|
5 |
|
|
|
24 |
allow_flagging="never",
|
25 |
)
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
with gr.Blocks() as demo:
|
28 |
gr.HTML(
|
29 |
"""
|
|
|
38 |
"<p align='center' style='font-size: 20px;'>MMS: Scaling Speech Technology to 1000+ languages demo. See our <a href='https://ai.facebook.com/blog/multilingual-model-speech-recognition/'>blog post</a> and <a href='https://arxiv.org/abs/2305.13516'>paper</a>.</p>"
|
39 |
)
|
40 |
gr.HTML(
|
41 |
+
"""<center>You can also finetune MMS models on your data using the recipes provides <a href='https://huggingface.co/blog/mms_adapters'>here</a>.</center>"""
|
|
|
|
|
|
|
42 |
)
|
43 |
gr.HTML(
|
44 |
"""<center><a href="https://huggingface.co/spaces/facebook/MMS?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank"><img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> for more control and no queue.</center>"""
|
45 |
)
|
46 |
|
47 |
+
mms_transcribe.render()
|
48 |
gr.HTML(
|
49 |
"""
|
50 |
<div class="footer" style="text-align:center">
|