abidlabs HF Staff commited on
Commit
6d5b0b2
·
1 Parent(s): 4562bb8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import time
3
+
4
+ def speech_to_text(speech):
5
+ time.sleep(1)
6
+ return """SPEAKER_00: ''So I've prepared a presentation I'm sharing it with All you should be able to seat on your screen right now. Got it?'' from 0.258-6.249
7
+ SPEAKER_01: ''I don't see a link anywhere says it Headed down low a plug and.'' from 6.384-9.573""", """so i've prepared a presentation i'm sharing it with all you should be able to seat on your screen right now got it i don't see a link anywhere says it headed down low a plug and"""
8
+
9
+ def sentiment(checked_options):
10
+ time.sleep(0.3)
11
+ return {"happy": 0.5, "confused": 0.3, "sad": 0.2}
12
+
13
+ demo = gr.Blocks()
14
+
15
+ with demo:
16
+ with gr.Row():
17
+ with gr.Column():
18
+ audio = gr.Audio()
19
+ with gr.Row():
20
+ btn = gr.Button("Transcribe")
21
+ with gr.Column():
22
+ diarized = gr.Textbox(lines=5, label="Diarized Output")
23
+ full = gr.Textbox(lines=4, label="Full Transcript")
24
+ check = gr.CheckboxGroup(["Speaker 1", "Speaker 2"])
25
+ label = gr.Label()
26
+
27
+ btn.click(speech_to_text, audio, [diarized, full], status_tracker=gr.StatusTracker(cover_container=True))
28
+ check.change(sentiment, check, label, status_tracker=gr.StatusTracker(cover_container=True))
29
+
30
+ demo.launch()