MMS / app.py
jieminz's picture
Update app.py
054c552 verified
raw
history blame
2.35 kB
import gradio as gr
from asr import transcribe, ASR_EXAMPLES, ASR_LANGUAGES, ASR_NOTE
mms_transcribe = gr.Interface(
fn=transcribe,
inputs=[
gr.Audio(),
gr.Dropdown(
[f"{k} ({v})" for k, v in ASR_LANGUAGES.items()],
label="Language",
value="eng English",
),
# gr.Checkbox(label="Use Language Model (if available)", default=True),
],
outputs="text",
examples=ASR_EXAMPLES,
title="Speech-to-text",
description=(
"Transcribe audio from a microphone or input file in your desired language."
),
article=ASR_NOTE,
allow_flagging="never",
)
with gr.Blocks() as demo:
gr.HTML(
"""
<div style="text-align: center;">
<img src="https://huggingface.co/spaces/facebook/MMS/resolve/main/BANNER.png" alt="UNESCO Meta Hugging Face Banner" style="max-width: 800px; width: 100%; margin: 0 auto;">
<h1 style="color: #0077be;">Language Transcriber powered by UNESCO, Meta and Hugging Face</h1>
</div>
"""
)
gr.Markdown(
"<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>"
)
gr.HTML(
"""<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>"""
)
gr.HTML(
"""<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>"""
)
mms_transcribe.render()
gr.HTML(
"""
<div class="footer" style="text-align:center">
<p>
Model by <a href="https://ai.facebook.com" style="text-decoration: underline;" target="_blank">Meta AI</a> - Gradio Demo by πŸ€— Hugging Face
</p>
</div>
"""
)
if __name__ == "__main__":
demo.queue()
demo.launch()