Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,39 @@ def transcribe(audio):
|
|
30 |
|
31 |
|
32 |
|
33 |
-
gr.Interface(
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
|
32 |
|
33 |
+
# gr.Interface(
|
34 |
+
# title = 'Talk to NP',
|
35 |
+
# fn=transcribe,
|
36 |
+
# inputs=[
|
37 |
+
# gr.inputs.Audio(source="microphone", type="filepath")
|
38 |
+
# ],
|
39 |
+
# outputs=[
|
40 |
+
# "textbox"
|
41 |
+
# ],
|
42 |
+
# live=True).launch()
|
43 |
+
|
44 |
+
|
45 |
+
def speech_to_text(speech):
|
46 |
+
text = asr(speech)["text"]
|
47 |
+
return text
|
48 |
+
|
49 |
+
|
50 |
+
def text_to_sentiment(text):
|
51 |
+
return classifier(text)[0]["label"]
|
52 |
+
|
53 |
+
|
54 |
+
demo = gr.Blocks()
|
55 |
+
|
56 |
+
with demo:
|
57 |
+
audio_file = gr.Audio(type="filepath")
|
58 |
+
text1 = gr.Textbox()
|
59 |
+
text2 = gr.Textbox()
|
60 |
+
|
61 |
+
b1 = gr.Button("Transcribe audio")
|
62 |
+
b2 = gr.Button("Summarize")
|
63 |
+
|
64 |
+
b1.click(transcribe, inputs=audio_file, outputs=text)
|
65 |
+
b2.click(text_to_sentiment, inputs=text1, outputs=text)
|
66 |
+
|
67 |
+
demo.launch()
|
68 |
+
|