Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
fe42216
1
Parent(s):
fd0073b
chore: tidy up main
Browse filesremoved unused code, primarily commented out / older versions
- src/main.py +7 -46
src/main.py
CHANGED
|
@@ -104,18 +104,6 @@ def main() -> None:
|
|
| 104 |
setup_input()
|
| 105 |
|
| 106 |
|
| 107 |
-
if 0:## WIP
|
| 108 |
-
# goal of this code is to allow the user to override the ML prediction, before transmitting an observations
|
| 109 |
-
predicted_class = st.sidebar.selectbox("Predicted Class", viewer.WHALE_CLASSES)
|
| 110 |
-
override_prediction = st.sidebar.checkbox("Override Prediction")
|
| 111 |
-
|
| 112 |
-
if override_prediction:
|
| 113 |
-
overridden_class = st.sidebar.selectbox("Override Class", viewer.WHALE_CLASSES)
|
| 114 |
-
st.session_state.observations['class_overriden'] = overridden_class
|
| 115 |
-
else:
|
| 116 |
-
st.session_state.observations['class_overriden'] = None
|
| 117 |
-
|
| 118 |
-
|
| 119 |
with tab_map:
|
| 120 |
# visual structure: a couple of toggles at the top, then the map inlcuding a
|
| 121 |
# dropdown for tileset selection.
|
|
@@ -218,6 +206,13 @@ def main() -> None:
|
|
| 218 |
# 6. manual validation done -> enable the upload buttons
|
| 219 |
#
|
| 220 |
with tab_inference:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
|
| 222 |
if st.session_state.MODE_DEV_STATEFUL:
|
| 223 |
dbg_show_observation_hashes()
|
|
@@ -292,40 +287,6 @@ def main() -> None:
|
|
| 292 |
# didn't decide what the next state is here - I think we are in the terminal state.
|
| 293 |
#st.session_state.workflow_fsm.complete_current_state()
|
| 294 |
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
# inside the inference tab, on button press we call the model (on huggingface hub)
|
| 303 |
-
# which will be run locally.
|
| 304 |
-
# - the model predicts the top 3 most likely species from the input image
|
| 305 |
-
# - these species are shown
|
| 306 |
-
# - the user can override the species prediction using the dropdown
|
| 307 |
-
# - an observation is uploaded if the user chooses.
|
| 308 |
-
|
| 309 |
-
# with tab_inference:
|
| 310 |
-
# add_classifier_header()
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
# if tab_inference.button("Identify with cetacean classifier"):
|
| 315 |
-
# #pipe = pipeline("image-classification", model="Saving-Willy/cetacean-classifier", trust_remote_code=True)
|
| 316 |
-
# cetacean_classifier = AutoModelForImageClassification.from_pretrained("Saving-Willy/cetacean-classifier",
|
| 317 |
-
# revision=classifier_revision,
|
| 318 |
-
# trust_remote_code=True)
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
# if st.session_state.images is None:
|
| 322 |
-
# # TODO: cleaner design to disable the button until data input done?
|
| 323 |
-
# st.info("Please upload an image first.")
|
| 324 |
-
# else:
|
| 325 |
-
# cetacean_classify(cetacean_classifier)
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
|
| 330 |
# inside the hotdog tab, on button press we call a 2nd model (totally unrelated at present, just for demo
|
| 331 |
# purposes, an hotdog image classifier) which will be run locally.
|
|
|
|
| 104 |
setup_input()
|
| 105 |
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
with tab_map:
|
| 108 |
# visual structure: a couple of toggles at the top, then the map inlcuding a
|
| 109 |
# dropdown for tileset selection.
|
|
|
|
| 206 |
# 6. manual validation done -> enable the upload buttons
|
| 207 |
#
|
| 208 |
with tab_inference:
|
| 209 |
+
# inside the inference tab, on button press we call the model (on huggingface hub)
|
| 210 |
+
# which will be run locally.
|
| 211 |
+
# - the model predicts the top 3 most likely species from the input image
|
| 212 |
+
# - these species are shown
|
| 213 |
+
# - the user can override the species prediction using the dropdown
|
| 214 |
+
# - an observation is uploaded if the user chooses.
|
| 215 |
+
|
| 216 |
|
| 217 |
if st.session_state.MODE_DEV_STATEFUL:
|
| 218 |
dbg_show_observation_hashes()
|
|
|
|
| 287 |
# didn't decide what the next state is here - I think we are in the terminal state.
|
| 288 |
#st.session_state.workflow_fsm.complete_current_state()
|
| 289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
|
| 291 |
# inside the hotdog tab, on button press we call a 2nd model (totally unrelated at present, just for demo
|
| 292 |
# purposes, an hotdog image classifier) which will be run locally.
|