Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def inference_text(audio):
|
|
52 |
sentiment_task = pipeline("sentiment-analysis", model=model_nlp, tokenizer=tokenizer)
|
53 |
res=sentiment_task(text)[0]
|
54 |
|
55 |
-
return res['label'],res['score']
|
56 |
|
57 |
|
58 |
def extract_features(data):
|
@@ -91,17 +91,17 @@ def audio_emotions(audio):
|
|
91 |
return y_pred
|
92 |
"""
|
93 |
def main(audio):
|
94 |
-
r1,r2=inference_text(audio)
|
95 |
#r3=audio_emotions(audio)
|
96 |
-
return r1,r2
|
97 |
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
|
107 |
-
app=gr.Interface(title="Sentiment Audio Analysis",fn=main,inputs=
|
|
|
52 |
sentiment_task = pipeline("sentiment-analysis", model=model_nlp, tokenizer=tokenizer)
|
53 |
res=sentiment_task(text)[0]
|
54 |
|
55 |
+
return text,res['label'],res['score']
|
56 |
|
57 |
|
58 |
def extract_features(data):
|
|
|
91 |
return y_pred
|
92 |
"""
|
93 |
def main(audio):
|
94 |
+
r1,r2,r3=inference_text(audio)
|
95 |
#r3=audio_emotions(audio)
|
96 |
+
return r1,r2,r3
|
97 |
|
98 |
|
99 |
+
audio = gr.Audio(
|
100 |
+
label="Input Audio",
|
101 |
+
show_label=False,
|
102 |
+
source="microphone",
|
103 |
+
type="filepath"
|
104 |
+
)
|
105 |
|
106 |
|
107 |
+
app=gr.Interface(title="Sentiment Audio Analysis",fn=main,inputs=audio, outputs=["text","text","text"]).launch(debug = True)
|