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: WAL.Data@unesco.org. """ with gr.Blocks() as demo: gr.HTML( """
UNESCO Meta Hugging Face Banner

In support of Linguistic Diversity and the International Decade of Indigenous Languages powered by Meta and Hugging Face

""" ) gr.Markdown( "

MMS: Scaling Speech Technology to 1000+ languages demo. See our blog post and paper.

" ) gr.HTML( """
You can also finetune MMS models on your data using the recipes provides here.
""" ) gr.HTML( """
Duplicate Space for more control and no queue.
""" ) mms_transcribe.render() gr.HTML( """ """ ) with gr.Row(): gr.Markdown(disclaimer) if __name__ == "__main__": demo.queue() demo.launch()