File size: 4,090 Bytes
a7d6efe d17cb1f a7d6efe d17cb1f 9d1e653 d17cb1f 84c9a09 3181eaa 84c9a09 3181eaa 84c9a09 d17cb1f cc776df 1aeedda d35cb4c cc776df d17cb1f 6c34003 d17cb1f 6c34003 84c9a09 d17cb1f 84c9a09 d17cb1f |
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
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="Automatic Speech Recognition (Speech-to-text)",
description=(
"Transcribe audio from a microphone or input file in your desired language."
),
article=ASR_NOTE,
allow_flagging="never",
)
disclaimer = """
## Disclaimer
This transcription interface, developed as part of UNESCO's work on Multilingualism and supported by Meta's MMS AI model and Hugging Face, is designed to assist with language transcription using open-source AI technologies. However, transcriptions generated by the tool may not be accurate or perfect. While we strive to provide accurate transcriptions, the tool may produce inaccuracies due to the complexity and nuances of different languages.
- The tool may not fully capture the context, cultural nuances, idiomatic expressions, or specific terminologies.
- Manual review and adjustment are recommended for important transcriptions.
- The transcriptions are provided "as is" without any warranties of any kind, either expressed or implied.
- Users should not rely solely on the tool for critical or sensitive transcriptions and are responsible for verifying the accuracy and appropriateness of the transcriptions for their specific needs.
- We recommend consulting with professional transcribers for official, legal, medical, or other critical transcriptions.
- We shall not be liable for any direct, indirect, incidental, special, or consequential damages arising out of or in connection with the use or inability to use the transcription tool, including but not limited to errors or omissions in transcriptions.
By using this transcription tool, you agree to these terms and acknowledge that the use of the tool is at your own risk.
For any feedback or support, please contact UNESCO World Atlas of Languages Team: [email protected].
"""
with gr.Blocks() as demo:
gr.HTML(
"""
<div style="text-align: center;">
<img src="https://huggingface.co/spaces/UNESCO/MMS/resolve/main/UNESCO_META_HF_BANNER.png" alt="UNESCO Meta Hugging Face Banner" style="max-width: 800px; width: 100%; margin: 0 auto;">
<h1 style="color: #0077be;">In support of Linguistic Diversity and the International Decade of Indigenous Languages powered by 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>
"""
)
with gr.Row():
gr.Markdown(disclaimer)
if __name__ == "__main__":
demo.queue()
demo.launch() |