|
import gradio as gr |
|
import core |
|
|
|
with gr.Blocks(css = "css/index.css") as iface: |
|
gr.Markdown(elem_id="logo" , value="") |
|
with gr.Row(): |
|
with gr.Tab("Upload Audio as File"): |
|
audio_input_u = gr.Audio(label = 'Upload Audio',source="upload",type="filepath") |
|
transcribe_audio_u = gr.Button('Transcribe') |
|
|
|
with gr.Tab("Record Audio"): |
|
audio_input_r = gr.Audio(label = 'Record Audio Input',source="microphone") |
|
transcribe_audio_r = gr.Button('Transcribe') |
|
|
|
with gr.Tab("Summarize Video from URL"): |
|
url_input = gr.Textbox(label="URL") |
|
transcribe_url = gr.Button('Transcribe') |
|
|
|
with gr.Row(equal_height=True): |
|
with gr.Column(scale=2): |
|
asr_out_text = gr.Textbox(label="Transcript", lines=2, max_lines=20) |
|
asr_out_lang = gr.Dropdown(["English", "Vietnamese"], label="Language") |
|
with gr.Column(scale=1): |
|
asr_out_text_detail = gr.Textbox(label="Detail", lines=6, max_lines=24) |
|
|
|
with gr.Column(): |
|
summarize_btn = gr.Button("Summarize") |
|
summarize_out = gr.Textbox(label="Summarization") |
|
|
|
transcribe_audio_r.click(core.asr_transcript, audio_input_r, [asr_out_text, asr_out_lang, asr_out_text_detail]) |
|
transcribe_audio_u.click(core.asr_transcript, audio_input_u, [asr_out_text, asr_out_lang, asr_out_text_detail]) |
|
|
|
summarize_btn.click(core.text_summarize, [asr_out_text, asr_out_lang], summarize_out) |
|
|
|
examples = gr.Examples(examples=["Doc Truyen Dem Khuya.mp3", "The Diver An Uncanny Tale.mp3"], |
|
inputs=[audio_input_u]) |
|
|
|
iface.launch(debug=True) |