xtlyxt commited on
Commit
ef16413
·
verified ·
1 Parent(s): d67d59d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -18,7 +18,6 @@ uploaded_images = st.file_uploader("Upload images", type=["jpg", "png"], accept_
18
  # Display thumbnail images alongside file names and sizes in the sidebar
19
  selected_images = []
20
  if uploaded_images:
21
- uploaded_images = list(reversed(uploaded_images)) # Reverse the order of uploaded images
22
  for idx, img in enumerate(uploaded_images):
23
  image = Image.open(img)
24
  checkbox_key = f"{img.name}_checkbox_{idx}" # Unique key for each checkbox
@@ -66,5 +65,5 @@ if st.button("Predict Emotions") and selected_images:
66
  st.write(f"Emotion Scores for #{i+1} Image")
67
  st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
68
  # Use the index to get the corresponding filename
69
- st.write(f"Original File Name: {uploaded_images[i].name if i < len(uploaded_images) else 'Unknown'}")
70
-
 
18
  # Display thumbnail images alongside file names and sizes in the sidebar
19
  selected_images = []
20
  if uploaded_images:
 
21
  for idx, img in enumerate(uploaded_images):
22
  image = Image.open(img)
23
  checkbox_key = f"{img.name}_checkbox_{idx}" # Unique key for each checkbox
 
65
  st.write(f"Emotion Scores for #{i+1} Image")
66
  st.write(f"{predicted_emotion}: {result[0]['score']:.4f}")
67
  # Use the index to get the corresponding filename
68
+ reversed_uploaded_images = reversed(uploaded_images)
69
+ st.write(f"Original File Name: {list(reversed_uploaded_images)[i].name if i < len(uploaded_images) else 'Unknown'}")