xtlyxt commited on
Commit
8f3f272
·
verified ·
1 Parent(s): 223f5c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -28,6 +28,9 @@ if uploaded_image:
28
  st.image(image, caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
29
 
30
  # Display scores for each category
31
- st.write("Emotion Scores:")
32
- for score in results[0]["scores"]:
33
- st.write(f"{score:.4f}")
 
 
 
 
28
  st.image(image, caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
29
 
30
  # Display scores for each category
31
+ if "scores" in results[0]:
32
+ st.write("Emotion Scores:")
33
+ for label, score in zip(emotion_labels, results[0]["scores"]):
34
+ st.write(f"{label}: {score:.4f}")
35
+ else:
36
+ st.write("Emotion scores not available for this prediction.")