Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,28 +31,30 @@ else:
|
|
31 |
ensembler = ToneEnsembler()
|
32 |
result = ensembler.predict_emotion(user_input)
|
33 |
|
34 |
-
# π Results
|
35 |
st.subheader("π« Your Emotional Reflection")
|
|
|
|
|
36 |
st.markdown(f"**Empathetic Tone:** *{result['empathetic'].capitalize()}*")
|
37 |
|
38 |
st.markdown("**Top Empathetic Scores:**")
|
39 |
for label, score in result["empathetic_scores"].items():
|
40 |
st.write(f"{label.capitalize()}: {score:.2f}")
|
|
|
41 |
|
|
|
42 |
st.markdown("**GoEmotions Tags:** " + ", ".join(result["goemotions"]))
|
|
|
|
|
43 |
st.success("π Vibe Tags: " + ", ".join(result["vibes"]))
|
44 |
|
|
|
45 |
st.markdown("**GoEmotions Confidence Scores:**")
|
46 |
for label, score in result["goemotions_confidence"].items():
|
47 |
native_score = float(score)
|
48 |
-
native_score = max(0.0, min(1.0, native_score))
|
49 |
st.write(f"{label.capitalize()}: {native_score:.3f}")
|
50 |
-
st.progress(native_score)
|
51 |
|
52 |
-
#
|
53 |
st.subheader("π Overall Sentiment")
|
54 |
-
|
55 |
-
sentiment_score = round(result["sentiment_score"] * 100, 2)
|
56 |
-
st.markdown(f"**Predicted Sentiment:** *{sentiment_label.capitalize()}*")
|
57 |
st.progress(result["sentiment_score"])
|
58 |
-
st.write(f"Confidence: {sentiment_score:.2f}%")
|
|
|
31 |
ensembler = ToneEnsembler()
|
32 |
result = ensembler.predict_emotion(user_input)
|
33 |
|
|
|
34 |
st.subheader("π« Your Emotional Reflection")
|
35 |
+
|
36 |
+
# π¬ Empathetic Tone
|
37 |
st.markdown(f"**Empathetic Tone:** *{result['empathetic'].capitalize()}*")
|
38 |
|
39 |
st.markdown("**Top Empathetic Scores:**")
|
40 |
for label, score in result["empathetic_scores"].items():
|
41 |
st.write(f"{label.capitalize()}: {score:.2f}")
|
42 |
+
st.progress(score)
|
43 |
|
44 |
+
# π― GoEmotions Tags
|
45 |
st.markdown("**GoEmotions Tags:** " + ", ".join(result["goemotions"]))
|
46 |
+
|
47 |
+
# π Vibe Tags
|
48 |
st.success("π Vibe Tags: " + ", ".join(result["vibes"]))
|
49 |
|
50 |
+
# π GoEmotions Confidence
|
51 |
st.markdown("**GoEmotions Confidence Scores:**")
|
52 |
for label, score in result["goemotions_confidence"].items():
|
53 |
native_score = float(score)
|
|
|
54 |
st.write(f"{label.capitalize()}: {native_score:.3f}")
|
55 |
+
st.progress(min(max(native_score, 0.0), 1.0)) # Clamp between 0-1
|
56 |
|
57 |
+
# π Sentiment
|
58 |
st.subheader("π Overall Sentiment")
|
59 |
+
st.write(f"Sentiment: **{result['sentiment_label']}**")
|
|
|
|
|
60 |
st.progress(result["sentiment_score"])
|
|