Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,6 +15,13 @@ st.write(f"{x} squared is {x * x}")
|
|
15 |
# Upload images
|
16 |
uploaded_images = st.file_uploader("Upload images", type=["jpg", "png"], accept_multiple_files=True)
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
if st.button("Predict Emotions") and uploaded_images:
|
19 |
if len(uploaded_images) == 2:
|
20 |
# Open the uploaded images
|
@@ -33,9 +40,6 @@ if st.button("Predict Emotions") and uploaded_images:
|
|
33 |
col.image(images[i], caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
|
34 |
col.write(f"Emotion Scores: {predicted_emotion}: {results[i][0]['score']:.4f}")
|
35 |
col.write(f"Original File Name: {file_names[i]}") # Display original file name
|
36 |
-
# Display thumbnail view
|
37 |
-
col.write(f"Thumbnail:")
|
38 |
-
col.image(images[i], use_column_width='auto')
|
39 |
|
40 |
# Display the keys and values of all results
|
41 |
st.write("Keys and Values of all results:")
|
@@ -63,6 +67,3 @@ if st.button("Predict Emotions") and uploaded_images:
|
|
63 |
st.write(f"Emotion Scores for #{i+1} Image")
|
64 |
st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
|
65 |
st.write(f"Original File Name: {uploaded_images[i].name}") # Display original file name
|
66 |
-
# Display thumbnail view
|
67 |
-
st.write(f"Thumbnail:")
|
68 |
-
st.image(images[i], use_column_width='auto')
|
|
|
15 |
# Upload images
|
16 |
uploaded_images = st.file_uploader("Upload images", type=["jpg", "png"], accept_multiple_files=True)
|
17 |
|
18 |
+
# Display thumbnail images alongside file names and sizes in the sidebar
|
19 |
+
if uploaded_images:
|
20 |
+
st.sidebar.title("Uploaded Images:")
|
21 |
+
for img in uploaded_images:
|
22 |
+
image = Image.open(img)
|
23 |
+
st.sidebar.image(image, caption=f"{img.name} {img.size / 1024.0:.1f} KB", width=40)
|
24 |
+
|
25 |
if st.button("Predict Emotions") and uploaded_images:
|
26 |
if len(uploaded_images) == 2:
|
27 |
# Open the uploaded images
|
|
|
40 |
col.image(images[i], caption=f"Predicted emotion: {predicted_emotion}", use_column_width=True)
|
41 |
col.write(f"Emotion Scores: {predicted_emotion}: {results[i][0]['score']:.4f}")
|
42 |
col.write(f"Original File Name: {file_names[i]}") # Display original file name
|
|
|
|
|
|
|
43 |
|
44 |
# Display the keys and values of all results
|
45 |
st.write("Keys and Values of all results:")
|
|
|
67 |
st.write(f"Emotion Scores for #{i+1} Image")
|
68 |
st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
|
69 |
st.write(f"Original File Name: {uploaded_images[i].name}") # Display original file name
|
|
|
|
|
|