Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from transformers import pipeline
|
|
6 |
pipe = pipeline("image-classification", model="trpakov/vit-face-expression", top_k=None)
|
7 |
|
8 |
# Define emotion labels
|
9 |
-
emotion_labels = ["Neutral", "Sad", "Angry", "Surprised", "Happy"]
|
10 |
|
11 |
# Streamlit app
|
12 |
st.title("Emotion Recognition with vit-face-expression")
|
@@ -48,6 +48,6 @@ if st.button("Predict Emotions") and uploaded_images:
|
|
48 |
predicted_class = result[0]["label"]
|
49 |
predicted_emotion = predicted_class.split("_")[-1].capitalize()
|
50 |
st.image(images[i], caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
|
51 |
-
st.write(f"Emotion Scores for #{i+1}
|
52 |
st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
|
53 |
st.write(f"Original File Name: {uploaded_images[i].name}") # Display original file name
|
|
|
6 |
pipe = pipeline("image-classification", model="trpakov/vit-face-expression", top_k=None)
|
7 |
|
8 |
# Define emotion labels
|
9 |
+
#emotion_labels = ["Neutral", "Sad", "Angry", "Surprised", "Happy"]
|
10 |
|
11 |
# Streamlit app
|
12 |
st.title("Emotion Recognition with vit-face-expression")
|
|
|
48 |
predicted_class = result[0]["label"]
|
49 |
predicted_emotion = predicted_class.split("_")[-1].capitalize()
|
50 |
st.image(images[i], caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
|
51 |
+
st.write(f"Emotion Scores for #{i+1} Image")
|
52 |
st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
|
53 |
st.write(f"Original File Name: {uploaded_images[i].name}") # Display original file name
|