Update app.py
Browse files
app.py
CHANGED
|
@@ -4,11 +4,12 @@ import gradio as gr
|
|
| 4 |
pipe = pipeline("text-classification", model="michellejieli/emotion_text_classifier")
|
| 5 |
|
| 6 |
def predict_emotion(text):
|
| 7 |
-
|
| 8 |
-
|
| 9 |
gr.Interface(
|
| 10 |
fn=predict_emotion,
|
| 11 |
inputs="text",
|
| 12 |
-
outputs="
|
| 13 |
title="Emotion Text Classifier"
|
| 14 |
).launch()
|
|
|
|
|
|
| 4 |
pipe = pipeline("text-classification", model="michellejieli/emotion_text_classifier")
|
| 5 |
|
| 6 |
def predict_emotion(text):
|
| 7 |
+
result = pipe(text)[0]
|
| 8 |
+
return result["label"]
|
| 9 |
gr.Interface(
|
| 10 |
fn=predict_emotion,
|
| 11 |
inputs="text",
|
| 12 |
+
outputs="text",
|
| 13 |
title="Emotion Text Classifier"
|
| 14 |
).launch()
|
| 15 |
+
|