-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket: CVS-147626 Notebooks: 1. magika-content-type-recognition/magika-content-type-recognition.ipynb - minimal Gradio demo, helper not needed 2. mms-massively-multilingual-speech/mms-massively-multilingual-speech.ipynb 3. mobilevlm-language-assistant/mobilevlm-language-assistant.ipynb - minimal Gradio demo, helper not needed 4. music-generation/music-generation.ipynb - minimal Gradio demo, helper not needed 5. named-entity-recognition/named-entity-recognition.ipynb - minimal Gradio demo, helper not needed 6. nano-llava-multimodal-chatbot/nano-llava-multimodal-chatbot.ipynb 7. oneformer-segmentation/oneformer-segmentation.ipynb 8. openvoice/openvoice.ipynb 9. paint-by-example/paint-by-example.ipynb 10. parler-tts-text-to-speech/parler-tts-text-to-speech.ipynb
- Loading branch information
Showing
16 changed files
with
659 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
notebooks/mms-massively-multilingual-speech/gradio_helper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from typing import Callable | ||
import gradio as gr | ||
|
||
|
||
title = "MMS with Gradio" | ||
description = ( | ||
'Gradio Demo for MMS and OpenVINO™. Upload a source audio, then click the "Submit" button to detect a language ID and a transcription. ' | ||
"Make sure that the audio data is sampled to 16000 kHz. If this language has not been used before, it may take some time to prepare the ASR model." | ||
"\n" | ||
"> Note: In order to run quantized model to transcribe some language, first the quantized model for that specific language must be prepared." | ||
) | ||
|
||
|
||
def make_demo(fn: Callable, quantized: bool): | ||
with gr.Blocks() as demo: | ||
with gr.Row(): | ||
gr.Markdown(f"# {title}") | ||
with gr.Row(): | ||
gr.Markdown(description) | ||
|
||
with gr.Row(): | ||
with gr.Column(): | ||
audio = gr.Audio(label="Source Audio", type="filepath") | ||
run_button = gr.Button(value="Run FP32") | ||
# if quantized: | ||
# run_quantized_button = gr.Button(value="Run INT8") | ||
with gr.Column(): | ||
detected_language = gr.Textbox(label="Detected language ID") | ||
transcription = gr.Textbox(label="Transcription") | ||
identification_time = gr.Textbox(label="Identification time") | ||
transcription_time = gr.Textbox(label="Transcription time") | ||
with gr.Row(visible=quantized): | ||
with gr.Column(): | ||
run_quantized_button = gr.Button(value="Run INT8") | ||
with gr.Column(): | ||
detected_language_quantized = gr.Textbox(label="Detected language ID (Quantized)") | ||
transcription_quantized = gr.Textbox(label="Transcription (Quantized)") | ||
identification_time_quantized = gr.Textbox(label="Identification time (Quantized)") | ||
transcription_time_quantized = gr.Textbox(label="Transcription time (Quantized)") | ||
|
||
run_button.click( | ||
fn=fn, | ||
inputs=[audio, gr.Number(0, visible=False)], | ||
outputs=[ | ||
detected_language, | ||
transcription, | ||
identification_time, | ||
transcription_time, | ||
], | ||
) | ||
if quantized: | ||
run_quantized_button.click( | ||
fn=fn, | ||
inputs=[audio, gr.Number(1, visible=False)], | ||
outputs=[ | ||
detected_language_quantized, | ||
transcription_quantized, | ||
identification_time_quantized, | ||
transcription_time_quantized, | ||
], | ||
) | ||
return demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.