Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -156,8 +156,7 @@ def predict_emotion(context):
|
|
156 |
emotion_prediction_pipeline = pipeline('text-classification', model=emotion_prediction_model, tokenizer=emotion_prediction_tokenizer, top_k=None)
|
157 |
predictions = emotion_prediction_pipeline(context)
|
158 |
emotion_scores = predictions[0]
|
159 |
-
|
160 |
-
emotion_pred = sorted_scores[0][0]
|
161 |
return emotion_pred
|
162 |
|
163 |
def generate_text(prompt, max_length=100, emotion=None):
|
|
|
156 |
emotion_prediction_pipeline = pipeline('text-classification', model=emotion_prediction_model, tokenizer=emotion_prediction_tokenizer, top_k=None)
|
157 |
predictions = emotion_prediction_pipeline(context)
|
158 |
emotion_scores = predictions[0]
|
159 |
+
emotion_pred = emotion_classes[np.argmax(emotion_scores)]
|
|
|
160 |
return emotion_pred
|
161 |
|
162 |
def generate_text(prompt, max_length=100, emotion=None):
|