Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,38 @@
|
|
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
|
|
|
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")
|
@@ -31,4 +43,14 @@ with demo:
|
|
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()
|
|
|
1 |
import gradio as gr
|
2 |
import time
|
3 |
|
4 |
+
EXAMPLES = ['test.wav']
|
5 |
+
|
6 |
def speech_to_text(speech):
|
7 |
time.sleep(1)
|
8 |
return [
|
9 |
+
("So I've prepared a presentation I'm sharing it with All you should be ", "Speaker 0"),
|
10 |
+
("able to seat on your screen right now. Got it?", "Speaker 0"),
|
11 |
("from 0.258-6.249", None),
|
12 |
("I don't see a link anywhere says it Headed down low a plug and.", "Speaker 1"),
|
13 |
+
("from 6.384-9.573", None)], """so i've prepared a presentation \n 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"""
|
14 |
|
15 |
def sentiment(checked_options):
|
16 |
time.sleep(0.3)
|
17 |
return {"happy": 0.5, "confused": 0.3, "sad": 0.2}
|
18 |
|
19 |
demo = gr.Blocks()
|
20 |
+
demo.encrypt = False
|
21 |
|
22 |
with demo:
|
23 |
with gr.Row():
|
24 |
with gr.Column():
|
25 |
+
audio = gr.Audio(label="Audio file")
|
26 |
with gr.Row():
|
27 |
btn = gr.Button("Transcribe")
|
28 |
+
|
29 |
+
with gr.Row():
|
30 |
+
examples = gr.components.Dataset(
|
31 |
+
components=[audio],
|
32 |
+
samples=[EXAMPLES],
|
33 |
+
type="index",
|
34 |
+
)
|
35 |
+
|
36 |
with gr.Column():
|
37 |
gr.Markdown("**Diarized Output:**")
|
38 |
diarized = gr.HighlightedText(lines=5, label="Diarized Output")
|
|
|
43 |
btn.click(speech_to_text, audio, [diarized, full], status_tracker=gr.StatusTracker(cover_container=True))
|
44 |
check.change(sentiment, check, label, status_tracker=gr.StatusTracker(cover_container=True))
|
45 |
|
46 |
+
def load_example(example_id):
|
47 |
+
processed_examples = audio.preprocess_example(EXAMPLES[example_id])
|
48 |
+
print(processed_examples)
|
49 |
+
return processed_examples
|
50 |
+
|
51 |
+
examples._click_no_postprocess(
|
52 |
+
load_example,
|
53 |
+
inputs=[examples],
|
54 |
+
outputs=[audio])
|
55 |
+
|
56 |
demo.launch()
|