Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +16 -14
src/streamlit_app.py
CHANGED
|
@@ -198,35 +198,36 @@ if 'model' not in st.session_state:
|
|
| 198 |
|
| 199 |
st.session_state.which_pic=1
|
| 200 |
|
| 201 |
-
st.session_state.calculating=
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
# Button to fetch a new image
|
| 206 |
col1, col2, col3 = st.columns([1,1,1])
|
| 207 |
|
| 208 |
-
if st.session_state.current_image is not None and st.session_state.started is False:
|
| 209 |
-
st.session_state.started=True
|
| 210 |
|
| 211 |
with col1:
|
| 212 |
-
if st.button("Start",
|
| 213 |
if not st.session_state.started:
|
| 214 |
fetch_image()
|
| 215 |
-
st.
|
|
|
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
# Display the current image
|
| 220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
if st.session_state.current_image is not None:
|
| 222 |
-
with col2:
|
| 223 |
-
if st.button("cat",disabled=st.session_state.calculating):
|
| 224 |
-
print("cat pressed")
|
| 225 |
-
st.session_state.label_input="cat"
|
| 226 |
-
with col3:
|
| 227 |
-
if st.button("dog",disabled=st.session_state.calculating):
|
| 228 |
-
print("dog pressed")
|
| 229 |
-
st.session_state.label_input="dog"
|
| 230 |
print(f"SHAPE:{st.session_state.current_image.shape}")
|
| 231 |
prediction = st.session_state.model.predict(np.array([st.session_state.current_image]))[0][0]
|
| 232 |
|
|
@@ -291,7 +292,8 @@ if st.session_state.calculating:
|
|
| 291 |
print("after fetch_image")
|
| 292 |
st.info(f"You clicked on last picture (picture {st.session_state.which_pic}): {label_input}")
|
| 293 |
st.session_state.which_pic=st.session_state.which_pic+1
|
| 294 |
-
|
|
|
|
| 295 |
|
| 296 |
|
| 297 |
|
|
|
|
| 198 |
|
| 199 |
st.session_state.which_pic=1
|
| 200 |
|
| 201 |
+
st.session_state.calculating=True
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
# Button to fetch a new image
|
| 206 |
col1, col2, col3 = st.columns([1,1,1])
|
| 207 |
|
|
|
|
|
|
|
| 208 |
|
| 209 |
with col1:
|
| 210 |
+
if st.button("Start",disabled=st.session_state.started):
|
| 211 |
if not st.session_state.started:
|
| 212 |
fetch_image()
|
| 213 |
+
st.session_state.started=True
|
| 214 |
+
st.session_state.calculating=False
|
| 215 |
+
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
# Display the current image
|
| 220 |
|
| 221 |
+
|
| 222 |
+
with col2:
|
| 223 |
+
if st.button("cat",disabled=st.session_state.calculating):
|
| 224 |
+
print("cat pressed")
|
| 225 |
+
st.session_state.label_input="cat"
|
| 226 |
+
with col3:
|
| 227 |
+
if st.button("dog",disabled=st.session_state.calculating):
|
| 228 |
+
print("dog pressed")
|
| 229 |
+
st.session_state.label_input="dog"
|
| 230 |
if st.session_state.current_image is not None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
print(f"SHAPE:{st.session_state.current_image.shape}")
|
| 232 |
prediction = st.session_state.model.predict(np.array([st.session_state.current_image]))[0][0]
|
| 233 |
|
|
|
|
| 292 |
print("after fetch_image")
|
| 293 |
st.info(f"You clicked on last picture (picture {st.session_state.which_pic}): {label_input}")
|
| 294 |
st.session_state.which_pic=st.session_state.which_pic+1
|
| 295 |
+
|
| 296 |
+
st.session_state.started=False
|
| 297 |
|
| 298 |
|
| 299 |
|