Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import core
|
| 3 |
|
| 4 |
-
with gr.Blocks(css = "
|
| 5 |
gr.Markdown(elem_id="logo" , value="")
|
| 6 |
with gr.Row():
|
| 7 |
with gr.Tab("Upload Audio as File"):
|
|
@@ -9,11 +9,15 @@ with gr.Blocks(css = "css/index.css") as iface:
|
|
| 9 |
transcribe_audio_u = gr.Button('Transcribe')
|
| 10 |
|
| 11 |
with gr.Tab("Record Audio"):
|
| 12 |
-
audio_input_r = gr.Audio(label = 'Record Audio Input',source="microphone")
|
| 13 |
transcribe_audio_r = gr.Button('Transcribe')
|
| 14 |
|
| 15 |
with gr.Tab("Summarize Video from URL"):
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
transcribe_url = gr.Button('Transcribe')
|
| 18 |
|
| 19 |
with gr.Row(equal_height=True):
|
|
@@ -27,12 +31,16 @@ with gr.Blocks(css = "css/index.css") as iface:
|
|
| 27 |
summarize_btn = gr.Button("Summarize")
|
| 28 |
summarize_out = gr.Textbox(label="Summarization")
|
| 29 |
|
| 30 |
-
transcribe_audio_r.click(core.asr_transcript, audio_input_r, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 31 |
transcribe_audio_u.click(core.asr_transcript, audio_input_u, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
summarize_btn.click(core.text_summarize, [asr_out_text, asr_out_lang], summarize_out)
|
| 34 |
|
| 35 |
examples = gr.Examples(examples=["Doc Truyen Dem Khuya.mp3", "The Diver An Uncanny Tale.mp3"],
|
| 36 |
inputs=[audio_input_u])
|
|
|
|
|
|
|
| 37 |
|
| 38 |
iface.launch(debug=True)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import core
|
| 3 |
|
| 4 |
+
with gr.Blocks(css = "app.css") as iface:
|
| 5 |
gr.Markdown(elem_id="logo" , value="")
|
| 6 |
with gr.Row():
|
| 7 |
with gr.Tab("Upload Audio as File"):
|
|
|
|
| 9 |
transcribe_audio_u = gr.Button('Transcribe')
|
| 10 |
|
| 11 |
with gr.Tab("Record Audio"):
|
| 12 |
+
audio_input_r = gr.Audio(label = 'Record Audio Input',source="microphone", type="filepath")
|
| 13 |
transcribe_audio_r = gr.Button('Transcribe')
|
| 14 |
|
| 15 |
with gr.Tab("Summarize Video from URL"):
|
| 16 |
+
with gr.Row():
|
| 17 |
+
with gr.Column(elem_id="video_elem"):
|
| 18 |
+
url_input = gr.Textbox(label="URL", elem_id="url_input")
|
| 19 |
+
video = gr.Video(show_label=False, interactive = False)
|
| 20 |
+
video.style(width=600)
|
| 21 |
transcribe_url = gr.Button('Transcribe')
|
| 22 |
|
| 23 |
with gr.Row(equal_height=True):
|
|
|
|
| 31 |
summarize_btn = gr.Button("Summarize")
|
| 32 |
summarize_out = gr.Textbox(label="Summarization")
|
| 33 |
|
|
|
|
| 34 |
transcribe_audio_u.click(core.asr_transcript, audio_input_u, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 35 |
+
transcribe_audio_r.click(core.asr_transcript, audio_input_r, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 36 |
+
# audio_input_r.stream(core.asr_transcript, audio_input_r, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 37 |
+
url_input.change(core.load_video_url, [url_input], video)
|
| 38 |
+
transcribe_url.click(core.asr_transcript, video, [asr_out_text, asr_out_lang, asr_out_text_detail])
|
| 39 |
summarize_btn.click(core.text_summarize, [asr_out_text, asr_out_lang], summarize_out)
|
| 40 |
|
| 41 |
examples = gr.Examples(examples=["Doc Truyen Dem Khuya.mp3", "The Diver An Uncanny Tale.mp3"],
|
| 42 |
inputs=[audio_input_u])
|
| 43 |
+
examples = gr.Examples(examples=["https://www.youtube.com/watch?v=ADi7F695d90"],
|
| 44 |
+
inputs=[url_input])
|
| 45 |
|
| 46 |
iface.launch(debug=True)
|