Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from asr import transcribe
|
3 |
+
from tts import synthesize
|
4 |
+
|
5 |
+
|
6 |
+
mms_transcribe = gr.Interface(
|
7 |
+
fn=transcribe,
|
8 |
+
inputs=[
|
9 |
+
gr.Audio()
|
10 |
+
],
|
11 |
+
outputs="text",
|
12 |
+
examples=ASR_EXAMPLES,
|
13 |
+
title="Speech-to-text",
|
14 |
+
description=(
|
15 |
+
"Transcribe audio from a microphone or input file."
|
16 |
+
),
|
17 |
+
article=ASR_NOTE,
|
18 |
+
allow_flagging="never",
|
19 |
+
)
|
20 |
+
|
21 |
+
mms_synthesize = gr.Interface(
|
22 |
+
fn=synthesize,
|
23 |
+
inputs=[
|
24 |
+
gr.Text(label="Input text"),
|
25 |
+
],
|
26 |
+
outputs=[
|
27 |
+
gr.Audio(label="Generated Audio", type="numpy"),
|
28 |
+
gr.Text(label="Filtered text after removing OOVs"),
|
29 |
+
],
|
30 |
+
examples=TTS_EXAMPLES,
|
31 |
+
title="Text-to-speech",
|
32 |
+
description=("Generate audio from input text."),
|
33 |
+
allow_flagging="never",
|
34 |
+
)
|
35 |
+
|
36 |
+
tabbed_interface = gr.TabbedInterface(
|
37 |
+
[mms_transcribe, mms_synthesize],
|
38 |
+
["Speech-to-text", "Text-to-speech"],
|
39 |
+
)
|
40 |
+
|
41 |
+
with gr.Blocks() as demo:
|
42 |
+
tabbed_interface.render()
|
43 |
+
|
44 |
+
if __name__ == "__main__":
|
45 |
+
demo.queue()
|
46 |
+
demo.launch()
|