Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,18 +86,18 @@ def home():
|
|
| 86 |
X = si_vectorizer.transform([text])
|
| 87 |
pred = si_classifier.predict(X)[0]
|
| 88 |
emotion = si_label_encoder.inverse_transform([pred])[0]
|
| 89 |
-
sinhala_result = f"
|
| 90 |
else:
|
| 91 |
-
sinhala_result = "
|
| 92 |
|
| 93 |
# Tamil – still transformers / pipeline
|
| 94 |
elif action == "predict_tamil":
|
| 95 |
text = request.form.get("tamil_text", "").strip()
|
| 96 |
if text:
|
| 97 |
res = tamil_pipe(text)[0]
|
| 98 |
-
tamil_result = f"
|
| 99 |
else:
|
| 100 |
-
tamil_result = "
|
| 101 |
|
| 102 |
return render_template(
|
| 103 |
"index.html",
|
|
|
|
| 86 |
X = si_vectorizer.transform([text])
|
| 87 |
pred = si_classifier.predict(X)[0]
|
| 88 |
emotion = si_label_encoder.inverse_transform([pred])[0]
|
| 89 |
+
sinhala_result = f"Emotion: {emotion}"
|
| 90 |
else:
|
| 91 |
+
sinhala_result = "Please write something"
|
| 92 |
|
| 93 |
# Tamil – still transformers / pipeline
|
| 94 |
elif action == "predict_tamil":
|
| 95 |
text = request.form.get("tamil_text", "").strip()
|
| 96 |
if text:
|
| 97 |
res = tamil_pipe(text)[0]
|
| 98 |
+
tamil_result = f"Emotion: {res['label']} ({res['score']:.3f})"
|
| 99 |
else:
|
| 100 |
+
tamil_result = "Please write something"
|
| 101 |
|
| 102 |
return render_template(
|
| 103 |
"index.html",
|