File size: 1,131 Bytes
20aa839
 
a4939e4
20aa839
 
 
 
 
 
 
 
e7164c6
20aa839
 
 
 
f23608f
20aa839
 
 
a4939e4
 
 
 
 
 
 
 
 
e7164c6
a4939e4
 
 
 
20aa839
 
a4939e4
 
20aa839
 
a4939e4
 
 
 
 
20aa839
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import gradio as gr
from asr import transcribe
# from tts import synthesize


mms_transcribe = gr.Interface(
    fn=transcribe,
    inputs=[
        gr.Audio()
    ],
    outputs="text",
    #examples=ASR_EXAMPLES,
    title="Speech-to-text",
    description=(
        "Transcribe audio from a microphone or input file."
    ),
    #article=ASR_NOTE,
    allow_flagging="never",
)

# mms_synthesize = gr.Interface(
#     fn=synthesize,
#     inputs=[
#         gr.Text(label="Input text"),
#     ],
#     outputs=[
#         gr.Audio(label="Generated Audio", type="numpy"),
#         gr.Text(label="Filtered text after removing OOVs"),
#     ],
#     #examples=TTS_EXAMPLES,
#     title="Text-to-speech",
#     description=("Generate audio from input text."),
#     allow_flagging="never",
# )

tabbed_interface = gr.TabbedInterface(
    [mms_transcribe],
    ["Speech-to-text"],
)

# tabbed_interface = gr.TabbedInterface(
#     [mms_transcribe, mms_synthesize],
#     ["Speech-to-text", "Text-to-speech"],
# )

with gr.Blocks() as demo:
    tabbed_interface.render()

if __name__ == "__main__":
    demo.queue()
    demo.launch()