Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,6 @@ from transformers import pipeline
|
|
5 |
# Create an image classification pipeline with scores
|
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")
|
13 |
|
@@ -39,12 +36,14 @@ if st.button("Predict Emotions") and uploaded_images:
|
|
39 |
|
40 |
# Display the keys and values of all results
|
41 |
st.write("Keys and Values of all results:")
|
|
|
42 |
for i, result in enumerate(results):
|
43 |
-
|
|
|
44 |
for res in result:
|
45 |
label = res["label"]
|
46 |
score = res["score"]
|
47 |
-
|
48 |
|
49 |
else:
|
50 |
# Open the uploaded images
|
|
|
5 |
# Create an image classification pipeline with scores
|
6 |
pipe = pipeline("image-classification", model="trpakov/vit-face-expression", top_k=None)
|
7 |
|
|
|
|
|
|
|
8 |
# Streamlit app
|
9 |
st.title("Emotion Recognition with vit-face-expression")
|
10 |
|
|
|
36 |
|
37 |
# Display the keys and values of all results
|
38 |
st.write("Keys and Values of all results:")
|
39 |
+
col1, col2 = st.columns(2)
|
40 |
for i, result in enumerate(results):
|
41 |
+
col = col1 if i == 0 else col2
|
42 |
+
col.write(f"Keys and Values of results[{i}]:")
|
43 |
for res in result:
|
44 |
label = res["label"]
|
45 |
score = res["score"]
|
46 |
+
col.write(f"{label}: {score:.4f}")
|
47 |
|
48 |
else:
|
49 |
# Open the uploaded images
|