Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,8 +65,8 @@ _, row5_col2, row5_col3, row5_col4 = st.columns([1,4,4,1], gap="medium")
|
|
| 65 |
|
| 66 |
# heading
|
| 67 |
with row0_col1:
|
| 68 |
-
st.markdown("<h1 style='text-align: center;
|
| 69 |
-
st.markdown("<h3 style='text-align: center;
|
| 70 |
|
| 71 |
|
| 72 |
|
|
@@ -79,13 +79,13 @@ with row0_col1:
|
|
| 79 |
if st.session_state.screen == 0:
|
| 80 |
with row1_col1:
|
| 81 |
# overview
|
| 82 |
-
st.markdown("<p style='text-align: left;
|
| 83 |
|
| 84 |
# purchase option
|
| 85 |
-
st.markdown("<p style='text-align: center;
|
| 86 |
|
| 87 |
# email
|
| 88 |
-
st.markdown("<p style='text-align: center;
|
| 89 |
|
| 90 |
# proceed button
|
| 91 |
_, row1a_col1, _ = st.columns([2,1,2])
|
|
@@ -110,7 +110,7 @@ if st.session_state.screen == 0:
|
|
| 110 |
if st.session_state.screen == 1:
|
| 111 |
# heading and instructions
|
| 112 |
with row1_col1:
|
| 113 |
-
st.markdown("<p style='text-align: center;
|
| 114 |
|
| 115 |
# image uploader
|
| 116 |
with row2_col1:
|
|
@@ -133,7 +133,7 @@ if st.session_state.screen == 1:
|
|
| 133 |
st.rerun()
|
| 134 |
|
| 135 |
# image selector
|
| 136 |
-
st.markdown("<h4 style='text-align: center;
|
| 137 |
|
| 138 |
image_path = "/home/user/app/test_images/"
|
| 139 |
with row3_col1:
|
|
@@ -239,8 +239,8 @@ if st.session_state.screen == 2:
|
|
| 239 |
# predictions
|
| 240 |
if 'results' not in st.session_state or st.session_state.results == None:
|
| 241 |
st.write("\n\n")
|
| 242 |
-
st.markdown("<p style='text-align: center;
|
| 243 |
-
st.markdown("<p style='text-align: center;
|
| 244 |
st.session_state.results = st.session_state.model.predict(st.session_state.tiles, conf=st.session_state.confidence) # predict
|
| 245 |
st.rerun()
|
| 246 |
|
|
@@ -270,7 +270,7 @@ if st.session_state.screen == 2:
|
|
| 270 |
st.write(st.session_state.output)
|
| 271 |
|
| 272 |
# plot predicted image
|
| 273 |
-
st.markdown(f"<h4 style='text-align: center;
|
| 274 |
im_bgr = st.session_state.results[st.session_state.image_counter].plot() # BGR-order numpy array
|
| 275 |
im_rgb = Image.fromarray(im_bgr[..., ::-1]) # RGB-order PIL image
|
| 276 |
st.image(im_rgb)
|
|
|
|
| 65 |
|
| 66 |
# heading
|
| 67 |
with row0_col1:
|
| 68 |
+
st.markdown("<h1 style='text-align: center;'>Find Waldo and His Friends</h1>", unsafe_allow_html=True)
|
| 69 |
+
st.markdown("<h3 style='text-align: center;'>Using Computer Vision</h3>", unsafe_allow_html=True)
|
| 70 |
|
| 71 |
|
| 72 |
|
|
|
|
| 79 |
if st.session_state.screen == 0:
|
| 80 |
with row1_col1:
|
| 81 |
# overview
|
| 82 |
+
st.markdown("<p style='text-align: left;'>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 finds Waldo and his friends Wenda, Odlaw, Wizard, and Woof.</p>", unsafe_allow_html=True)
|
| 83 |
|
| 84 |
# purchase option
|
| 85 |
+
st.markdown("<p style='text-align: center;'><a href='https://www.amazon.com/Wheres-Waldo-Ultimate-Watcher-Collection/dp/1536215112/ref=asc_df_1536215112/?tag=hyprod-20&linkCode=df0&hvadid=496186854683&hvpos=&hvnetw=g&hvrand=13774168920524356768&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9009670&hvtargid=pla-1185030597547&psc=1&mcid=a517c47662b13f96a80fbf3bfe8b30fe&gclid=CjwKCAjwuJ2xBhA3EiwAMVjkVADBaOb87R0kxhnpKqL-S_gJWme0DJJAwSTe-VlUv2p19zZKak3cshoCR34QAvD_BwE'>Purchase the Books</a></p>", unsafe_allow_html=True)
|
| 86 |
|
| 87 |
# email
|
| 88 |
+
st.markdown("<p style='text-align: center;'><a href=mailto:'Jared.L.Bailey@duke.edu'>Jared.L.Bailey@duke.edu</a></p>", unsafe_allow_html=True)
|
| 89 |
|
| 90 |
# proceed button
|
| 91 |
_, row1a_col1, _ = st.columns([2,1,2])
|
|
|
|
| 110 |
if st.session_state.screen == 1:
|
| 111 |
# heading and instructions
|
| 112 |
with row1_col1:
|
| 113 |
+
st.markdown("<p style='text-align: center;'>Upload an image using your cell phone (single book page), or select an image from the below list</p>", unsafe_allow_html=True)
|
| 114 |
|
| 115 |
# image uploader
|
| 116 |
with row2_col1:
|
|
|
|
| 133 |
st.rerun()
|
| 134 |
|
| 135 |
# image selector
|
| 136 |
+
st.markdown("<h4 style='text-align: center;'>Or Select One of the Following</h4>", unsafe_allow_html=True)
|
| 137 |
|
| 138 |
image_path = "/home/user/app/test_images/"
|
| 139 |
with row3_col1:
|
|
|
|
| 239 |
# predictions
|
| 240 |
if 'results' not in st.session_state or st.session_state.results == None:
|
| 241 |
st.write("\n\n")
|
| 242 |
+
st.markdown("<p style='text-align: center;'>The model is working. Please be patient...</p>", unsafe_allow_html=True)
|
| 243 |
+
st.markdown("<p style='text-align: center;'>This process can take up to 30 seconds.</p>", unsafe_allow_html=True)
|
| 244 |
st.session_state.results = st.session_state.model.predict(st.session_state.tiles, conf=st.session_state.confidence) # predict
|
| 245 |
st.rerun()
|
| 246 |
|
|
|
|
| 270 |
st.write(st.session_state.output)
|
| 271 |
|
| 272 |
# plot predicted image
|
| 273 |
+
st.markdown(f"<h4 style='text-align: center;'>Image Tile {str(st.session_state.image_counter + 1)}</h4>", unsafe_allow_html=True)
|
| 274 |
im_bgr = st.session_state.results[st.session_state.image_counter].plot() # BGR-order numpy array
|
| 275 |
im_rgb = Image.fromarray(im_bgr[..., ::-1]) # RGB-order PIL image
|
| 276 |
st.image(im_rgb)
|