kivilaid commited on
Commit
13edc61
·
1 Parent(s): 1ef5b21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -14,20 +14,18 @@ def main():
14
  st.title("Sock Image Uploader")
15
 
16
  # Image uploader
17
- uploaded_file = st.file_uploader("Take a picture of your sock and upload it here", type=["jpg", "png"], key="file_uploader")
18
-
19
- # If a file is uploaded, process and display it
20
- if uploaded_file is not None:
21
- # Convert the file to an image
22
- image = Image.open(uploaded_file)
23
- st.session_state.images.append(image)
24
-
25
- # Clear the file uploader for the next upload
26
- st.session_state.file_uploader = None
27
-
28
- # Display images
29
- for idx, img in enumerate(st.session_state.images, start=1):
30
- st.image(img, caption=f"Image {idx}", use_column_width=True)
31
 
32
  # Reset button
33
  if st.button('Reset and Start Over'):
 
14
  st.title("Sock Image Uploader")
15
 
16
  # Image uploader
17
+ uploaded_file = st.file_uploader("Take a picture of your sock and upload it here", type=["jpg", "png"])
18
+
19
+ # Button to confirm the upload and process the image
20
+ if st.button("Upload Next Image"):
21
+ if uploaded_file is not None:
22
+ # Convert the file to an image
23
+ image = Image.open(uploaded_file)
24
+ st.session_state.images.append(image)
25
+
26
+ # Display images
27
+ for idx, img in enumerate(st.session_state.images, start=1):
28
+ st.image(img, caption=f"Image {idx}", use_column_width=True)
 
 
29
 
30
  # Reset button
31
  if st.button('Reset and Start Over'):