Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
def speech_to_text(speech):
|
| 5 |
+
time.sleep(1)
|
| 6 |
+
return [
|
| 7 |
+
("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?", "Speaker 0"),
|
| 8 |
+
("from 0.258-6.249", None),
|
| 9 |
+
("I don't see a link anywhere says it Headed down low a plug and.", "Speaker 1"),
|
| 10 |
+
("from 6.384-9.573", None)], """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"""
|
| 11 |
+
|
| 12 |
+
def sentiment(checked_options):
|
| 13 |
+
time.sleep(0.3)
|
| 14 |
+
return {"happy": 0.5, "confused": 0.3, "sad": 0.2}
|
| 15 |
+
|
| 16 |
+
demo = gr.Blocks()
|
| 17 |
+
|
| 18 |
+
with demo:
|
| 19 |
+
with gr.Row():
|
| 20 |
+
with gr.Column():
|
| 21 |
+
audio = gr.Audio()
|
| 22 |
+
with gr.Row():
|
| 23 |
+
btn = gr.Button("Transcribe")
|
| 24 |
+
with gr.Column():
|
| 25 |
+
gr.Markdown("**Diarized Output:**")
|
| 26 |
+
diarized = gr.HighlightedText(lines=5, label="Diarized Output")
|
| 27 |
+
full = gr.Textbox(lines=4, label="Full Transcript")
|
| 28 |
+
check = gr.CheckboxGroup(["Speaker 1", "Speaker 2"], label="Choose speaker(s) for sentiment analysis")
|
| 29 |
+
label = gr.Label()
|
| 30 |
+
|
| 31 |
+
btn.click(speech_to_text, audio, [diarized, full], status_tracker=gr.StatusTracker(cover_container=True))
|
| 32 |
+
check.change(sentiment, check, label, status_tracker=gr.StatusTracker(cover_container=True))
|
| 33 |
+
|
| 34 |
+
demo.launch()
|