rivapereira123 commited on
Commit
b5d49ce
Β·
verified Β·
1 Parent(s): b09eb2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
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
- # ✨ Sentiment
53
  st.subheader("πŸ’Œ Overall Sentiment")
54
- sentiment_label = result["sentiment_label"]
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"])