abidlabs's picture
abidlabs HF Staff
Create app.py
e011c72
raw
history blame
1.48 kB
import gradio as gr
import time
def speech_to_text(speech):
time.sleep(1)
return [
("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"),
("from 0.258-6.249", None),
("I don't see a link anywhere says it Headed down low a plug and.", "Speaker 1"),
("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"""
def sentiment(checked_options):
time.sleep(0.3)
return {"happy": 0.5, "confused": 0.3, "sad": 0.2}
demo = gr.Blocks()
with demo:
with gr.Row():
with gr.Column():
audio = gr.Audio()
with gr.Row():
btn = gr.Button("Transcribe")
with gr.Column():
gr.Markdown("**Diarized Output:**")
diarized = gr.HighlightedText(lines=5, label="Diarized Output")
full = gr.Textbox(lines=4, label="Full Transcript")
check = gr.CheckboxGroup(["Speaker 1", "Speaker 2"], label="Choose speaker(s) for sentiment analysis")
label = gr.Label()
btn.click(speech_to_text, audio, [diarized, full], status_tracker=gr.StatusTracker(cover_container=True))
check.change(sentiment, check, label, status_tracker=gr.StatusTracker(cover_container=True))
demo.launch()