JaredBailey commited on
Commit
6b2623b
Β·
verified Β·
1 Parent(s): 7039748

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -71,9 +71,11 @@ if st.session_state.screen == 0:
71
  st.markdown("<p style='text-align: left; color: black;'>This tool allows you to take a photo with your phone of a <i>Where's Waldo?</i> book page. Using the computer vision model YOLOv8-large, this tool find Waldo and his friends Wenda, Odlaw, Wizard, and Woof.</p>", unsafe_allow_html=True)
72
 
73
  # proceed button
74
- if st.button(f"Proceed", key="Proceed"):
75
- st.session_state.screen = 1
76
- st.rerun()
 
 
77
 
78
  # image of Waldo and his friends
79
  st.image("/home/user/app/home_page_images/Waldo_Friends.jpg", use_column_width=True)
@@ -107,7 +109,6 @@ if st.session_state.screen == 1:
107
  uploaded_image = Image.open(uploaded_image)
108
  uploaded_image = ImageOps.exif_transpose(uploaded_image)
109
  st.session_state.image = uploaded_image
110
- uploaded_image = None
111
  st.session_state.screen = 2
112
  st.rerun()
113
 
@@ -119,7 +120,7 @@ if st.session_state.screen == 1:
119
  img_1 = Image.open(image_path + "IMG_5356.JPG")
120
  img_1 = ImageOps.exif_transpose(img_1)
121
  st.image(img_1, use_column_width=True)
122
- if st.button(f"Select Image ↑", key="button_1"):
123
  st.session_state.image = img_1
124
  st.session_state.screen = 2
125
  st.rerun()
@@ -127,7 +128,7 @@ if st.session_state.screen == 1:
127
  img_2 = Image.open(image_path + "IMG_5357.JPG")
128
  img_2 = ImageOps.exif_transpose(img_2)
129
  st.image(img_2, use_column_width=True)
130
- if st.button(f"Select Image ↑", key="button_2"):
131
  st.session_state.image = img_2
132
  st.session_state.screen = 2
133
  st.rerun()
@@ -135,15 +136,15 @@ if st.session_state.screen == 1:
135
  img_3 = Image.open(image_path + "IMG_5368.JPG")
136
  img_3 = ImageOps.exif_transpose(img_3)
137
  st.image(img_3, use_column_width=True)
138
- if st.button(f"Select Image ↑", key="button_3"):
139
  st.session_state.image = img_3
140
  st.session_state.screen = 2
141
  st.rerun()
142
  with row3_col4:
143
- img_4 = Image.open(image_path + "IMG_5369.JPG")
144
  img_4 = ImageOps.exif_transpose(img_4)
145
  st.image(img_4, use_column_width=True)
146
- if st.button(f"Select Image ↑", key="button_4"):
147
  st.session_state.image = img_4
148
  st.session_state.screen = 2
149
  st.rerun()
@@ -151,7 +152,7 @@ if st.session_state.screen == 1:
151
  img_5 = Image.open(image_path + "IMG_5382.JPG")
152
  img_5 = ImageOps.exif_transpose(img_5)
153
  st.image(img_5, use_column_width=True)
154
- if st.button(f"Select Image ↑", key="button_5"):
155
  st.session_state.image = img_5
156
  st.session_state.screen = 2
157
  st.rerun()
@@ -159,7 +160,7 @@ if st.session_state.screen == 1:
159
  img_6 = Image.open(image_path + "IMG_5383.JPG")
160
  img_6 = ImageOps.exif_transpose(img_6)
161
  st.image(img_6, use_column_width=True)
162
- if st.button(f"Select Image ↑", key="button_6"):
163
  st.session_state.image = img_6
164
  st.session_state.screen = 2
165
  st.rerun()
@@ -167,7 +168,7 @@ if st.session_state.screen == 1:
167
  img_7 = Image.open(image_path + "IMG_5408.JPG")
168
  img_7 = ImageOps.exif_transpose(img_7)
169
  st.image(img_7, use_column_width=True)
170
- if st.button(f"Select Image ↑", key="button_7"):
171
  st.session_state.image = img_7
172
  st.session_state.screen = 2
173
  st.rerun()
@@ -175,7 +176,7 @@ if st.session_state.screen == 1:
175
  img_8 = Image.open(image_path + "IMG_5409.JPG")
176
  img_8 = ImageOps.exif_transpose(img_8)
177
  st.image(img_8, use_column_width=True)
178
- if st.button(f"Select Image ↑", key="button_8"):
179
  st.session_state.image = img_8
180
  st.session_state.screen = 2
181
  st.rerun()
@@ -194,7 +195,7 @@ if st.session_state.screen == 2:
194
 
195
  with row5_col3:
196
  # navigation
197
- row5a_col0, row5a_col1, row5a_col2= st.columns([1,1,1], gap="medium")
198
  with row5a_col0:
199
  if st.button("Back", use_container_width=True):
200
  if st.session_state.image_counter > 0:
 
71
  st.markdown("<p style='text-align: left; color: black;'>This tool allows you to take a photo with your phone of a <i>Where's Waldo?</i> book page. Using the computer vision model YOLOv8-large, this tool find Waldo and his friends Wenda, Odlaw, Wizard, and Woof.</p>", unsafe_allow_html=True)
72
 
73
  # proceed button
74
+ _, row1a_col1, _ = st.columns([5,1,5])
75
+ with row1a_col1:
76
+ if st.button("Proceed", key="Proceed", use_container_width=True):
77
+ st.session_state.screen = 1
78
+ st.rerun()
79
 
80
  # image of Waldo and his friends
81
  st.image("/home/user/app/home_page_images/Waldo_Friends.jpg", use_column_width=True)
 
109
  uploaded_image = Image.open(uploaded_image)
110
  uploaded_image = ImageOps.exif_transpose(uploaded_image)
111
  st.session_state.image = uploaded_image
 
112
  st.session_state.screen = 2
113
  st.rerun()
114
 
 
120
  img_1 = Image.open(image_path + "IMG_5356.JPG")
121
  img_1 = ImageOps.exif_transpose(img_1)
122
  st.image(img_1, use_column_width=True)
123
+ if st.button("Select Image ↑", key="button_1", use_container_width=True):
124
  st.session_state.image = img_1
125
  st.session_state.screen = 2
126
  st.rerun()
 
128
  img_2 = Image.open(image_path + "IMG_5357.JPG")
129
  img_2 = ImageOps.exif_transpose(img_2)
130
  st.image(img_2, use_column_width=True)
131
+ if st.button("Select Image ↑", key="button_2", use_container_width=True):
132
  st.session_state.image = img_2
133
  st.session_state.screen = 2
134
  st.rerun()
 
136
  img_3 = Image.open(image_path + "IMG_5368.JPG")
137
  img_3 = ImageOps.exif_transpose(img_3)
138
  st.image(img_3, use_column_width=True)
139
+ if st.button("Select Image ↑", key="button_3", use_container_width=True):
140
  st.session_state.image = img_3
141
  st.session_state.screen = 2
142
  st.rerun()
143
  with row3_col4:
144
+ img_4 = Image.open(image_path + "IMG_5369.JPG", use_container_width=True)
145
  img_4 = ImageOps.exif_transpose(img_4)
146
  st.image(img_4, use_column_width=True)
147
+ if st.button("Select Image ↑", key="button_4", use_container_width=True):
148
  st.session_state.image = img_4
149
  st.session_state.screen = 2
150
  st.rerun()
 
152
  img_5 = Image.open(image_path + "IMG_5382.JPG")
153
  img_5 = ImageOps.exif_transpose(img_5)
154
  st.image(img_5, use_column_width=True)
155
+ if st.button("Select Image ↑", key="button_5", use_container_width=True):
156
  st.session_state.image = img_5
157
  st.session_state.screen = 2
158
  st.rerun()
 
160
  img_6 = Image.open(image_path + "IMG_5383.JPG")
161
  img_6 = ImageOps.exif_transpose(img_6)
162
  st.image(img_6, use_column_width=True)
163
+ if st.button("Select Image ↑", key="button_6", use_container_width=True):
164
  st.session_state.image = img_6
165
  st.session_state.screen = 2
166
  st.rerun()
 
168
  img_7 = Image.open(image_path + "IMG_5408.JPG")
169
  img_7 = ImageOps.exif_transpose(img_7)
170
  st.image(img_7, use_column_width=True)
171
+ if st.button("Select Image ↑", key="button_7", use_container_width=True):
172
  st.session_state.image = img_7
173
  st.session_state.screen = 2
174
  st.rerun()
 
176
  img_8 = Image.open(image_path + "IMG_5409.JPG")
177
  img_8 = ImageOps.exif_transpose(img_8)
178
  st.image(img_8, use_column_width=True)
179
+ if st.button("Select Image ↑", key="button_8", use_container_width=True):
180
  st.session_state.image = img_8
181
  st.session_state.screen = 2
182
  st.rerun()
 
195
 
196
  with row5_col3:
197
  # navigation
198
+ row5a_col0, row5a_col1, row5a_col2= st.columns([1,1,1], gap="large")
199
  with row5a_col0:
200
  if st.button("Back", use_container_width=True):
201
  if st.session_state.image_counter > 0: