xtlyxt commited on
Commit
7f5b20c
·
verified ·
1 Parent(s): f856b92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -5,6 +5,9 @@ from transformers import pipeline
5
  # Create an image classification pipeline
6
  pipe = pipeline("image-classification", model="trpakov/vit-face-expression")
7
 
 
 
 
8
  # Streamlit app
9
  st.title("Emotion Recognition with vit-face-expression")
10
 
@@ -24,8 +27,7 @@ if uploaded_image:
24
 
25
  st.image(image, caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
26
 
27
-
28
  # Display scores for each category
29
  st.write("Emotion Scores:")
30
- for label, score in zip(emotion_labels, outputs.logits[0]):
31
  st.write(f"{label}: {score:.4f}")
 
5
  # Create an image classification pipeline
6
  pipe = pipeline("image-classification", model="trpakov/vit-face-expression")
7
 
8
+ # Define emotion labels
9
+ emotion_labels = ["Happy", "Sad", "Angry", "Surprised", "Neutral"]
10
+
11
  # Streamlit app
12
  st.title("Emotion Recognition with vit-face-expression")
13
 
 
27
 
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 label, score in zip(emotion_labels, results[0]["scores"]):
33
  st.write(f"{label}: {score:.4f}")