File size: 1,135 Bytes
7f1afcd
297e244
7f1afcd
297e244
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7f1afcd
297e244
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
import gradio as gr
from zeroshot import process, ZS_EXAMPLES

with gr.Blocks() as demo:
    gr.Markdown("")
    gr.Markdown(
        "<p align='center' style='font-size: 20px;'>MMS Zero-shot ASR Demo. See our arXiV <a href='https://arxiv.org/'>paper</a> for model details.</p>"
    )
    gr.HTML(
        """<center>The demo works on input audio in any language, as long as you provide a list of words for that language and an optional n-gram language model (even a simple 1-gram model will work!) to help with accuracy.</center>"""
    )
    with gr.Row():
        with gr.Column():
            audio = gr.Audio(label="Audio Input\n(use microphone or upload a file)")
            with gr.Row():
                words_file = gr.File(label="Words File\n(one word per line)")
                lm_file = gr.File(label="Language Model\n(optional)")
            btn = gr.Button("Submit")
        with gr.Column():
            text = gr.Textbox(label="Transcript")
    btn.click(process, inputs=[audio, words_file, lm_file], outputs=text)
    examples = gr.Examples(examples=ZS_EXAMPLES, inputs=[audio, words_file])

demo.launch(share=True)