Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import core
|
3 |
+
|
4 |
+
with gr.Blocks(css = "css/index.css") as iface:
|
5 |
+
gr.Markdown(elem_id="logo" , value="")
|
6 |
+
with gr.Row():
|
7 |
+
with gr.Tab("Upload Audio as File"):
|
8 |
+
audio_input_u = gr.Audio(label = 'Upload Audio',source="upload",type="filepath")
|
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 |
+
url_input = gr.Textbox(label="URL")
|
17 |
+
transcribe_url = gr.Button('Transcribe')
|
18 |
+
|
19 |
+
with gr.Row(equal_height=True):
|
20 |
+
with gr.Column(scale=2):
|
21 |
+
asr_out_text = gr.Textbox(label="Transcript", lines=2, max_lines=20)
|
22 |
+
asr_out_lang = gr.Dropdown(["English", "Vietnamese"], label="Language")
|
23 |
+
with gr.Column(scale=1):
|
24 |
+
asr_out_text_detail = gr.Textbox(label="Detail", lines=6, max_lines=24)
|
25 |
+
|
26 |
+
with gr.Column():
|
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 |
+
# transcribe_url.click(asr_transcript_long, audio_input_u, asr_out)
|
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)
|