Update app.py
Browse files
app.py
CHANGED
@@ -25,23 +25,13 @@ def predict_emotion_from_audio(wav_filepath):
|
|
25 |
predicted_emotion_label = np.argmax(predictions[0]) + 1
|
26 |
return emotions[predicted_emotion_label]
|
27 |
|
28 |
-
|
29 |
-
def sentiment_vader(sentence):
|
30 |
-
sid_obj = SentimentIntensityAnalyzer()
|
31 |
-
sentiment_dict = sid_obj.polarity_scores(sentence)
|
32 |
-
if sentiment_dict['compound'] >= 0.05:
|
33 |
-
overall_sentiment = "Positive"
|
34 |
-
elif sentiment_dict['compound'] <= -0.05:
|
35 |
-
overall_sentiment = "Negative"
|
36 |
-
else:
|
37 |
-
overall_sentiment = "Neutral"
|
38 |
-
return overall_sentiment
|
39 |
|
40 |
# Create a combined function that calls both models
|
41 |
def get_predictions(audio_input):
|
42 |
emotion_prediction = predict_emotion_from_audio(audio_input)
|
43 |
-
|
44 |
-
return [emotion_prediction
|
45 |
|
46 |
# Create the Gradio interface
|
47 |
with gr.Blocks() as interface:
|
|
|
25 |
predicted_emotion_label = np.argmax(predictions[0]) + 1
|
26 |
return emotions[predicted_emotion_label]
|
27 |
|
28 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Create a combined function that calls both models
|
31 |
def get_predictions(audio_input):
|
32 |
emotion_prediction = predict_emotion_from_audio(audio_input)
|
33 |
+
|
34 |
+
return [emotion_prediction]
|
35 |
|
36 |
# Create the Gradio interface
|
37 |
with gr.Blocks() as interface:
|