Update app.py
Browse files
app.py
CHANGED
|
@@ -12,9 +12,15 @@ def predict(text):
|
|
| 12 |
label = result["label"]
|
| 13 |
score = round(result["score"], 4)
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
return f"{
|
| 18 |
|
| 19 |
|
| 20 |
with gr.Blocks(theme=gr.themes.Soft(), title="IMDb Sentiment Analyzer") as demo:
|
|
|
|
| 12 |
label = result["label"]
|
| 13 |
score = round(result["score"], 4)
|
| 14 |
|
| 15 |
+
# Map labels properly
|
| 16 |
+
if label == "LABEL_1":
|
| 17 |
+
sentiment = "Positive"
|
| 18 |
+
emoji = "😊"
|
| 19 |
+
else:
|
| 20 |
+
sentiment = "Negative"
|
| 21 |
+
emoji = "😡"
|
| 22 |
|
| 23 |
+
return f"{emoji} {sentiment}", f"Confidence: {score}", score
|
| 24 |
|
| 25 |
|
| 26 |
with gr.Blocks(theme=gr.themes.Soft(), title="IMDb Sentiment Analyzer") as demo:
|