Spaces:
Sleeping
Sleeping
rmm
commited on
Commit
·
4d0f7fd
1
Parent(s):
d4ec4a0
feat: using separate functions for ML flow (WIP)
Browse files- src/main.py +16 -6
src/main.py
CHANGED
@@ -21,7 +21,9 @@ from maps.alps_map import present_alps_map
|
|
21 |
from maps.obs_map import present_obs_map
|
22 |
from utils.st_logs import setup_logging, parse_log_buffer
|
23 |
from utils.workflow_state import WorkflowFSM, FSM_STATES
|
24 |
-
from classifier.classifier_image import cetacean_classify
|
|
|
|
|
25 |
from classifier.classifier_hotdog import hotdog_classify
|
26 |
|
27 |
|
@@ -229,7 +231,7 @@ def main() -> None:
|
|
229 |
|
230 |
if st.session_state.workflow_fsm.is_in_state('data_entry_complete'):
|
231 |
# can we advance state? - only when the validate button is pressed
|
232 |
-
if st.sidebar.button(":white_check_mark:[
|
233 |
# create a dictionary with the submitted observation
|
234 |
tab_log.info(f"{st.session_state.observations}")
|
235 |
df = pd.DataFrame(st.session_state.observations, index=[0])
|
@@ -263,10 +265,14 @@ def main() -> None:
|
|
263 |
revision=classifier_revision,
|
264 |
trust_remote_code=True)
|
265 |
|
266 |
-
|
267 |
st.session_state.workflow_fsm.complete_current_state()
|
|
|
|
|
|
|
|
|
268 |
|
269 |
-
|
270 |
# show the results, and allow manual validation
|
271 |
s = ""
|
272 |
for k, v in st.session_state.whale_prediction1.items():
|
@@ -281,8 +287,10 @@ def main() -> None:
|
|
281 |
if st.button("mock: manual validation done."):
|
282 |
st.session_state.workflow_fsm.complete_current_state()
|
283 |
# -> manual_inspection_completed
|
|
|
|
|
284 |
|
285 |
-
|
286 |
# show the ML results, and allow the user to upload the observation
|
287 |
st.markdown("""
|
288 |
### Inference Results (after manual validation)
|
@@ -293,8 +301,10 @@ def main() -> None:
|
|
293 |
if st.button("(nooop) Upload observation to THE INTERNET!"):
|
294 |
st.session_state.workflow_fsm.complete_current_state()
|
295 |
# -> data_uploaded
|
|
|
|
|
296 |
|
297 |
-
|
298 |
# the data has been sent. Lets show the observations again
|
299 |
# but no buttons to upload (or greyed out ok)
|
300 |
st.markdown("""
|
|
|
21 |
from maps.obs_map import present_obs_map
|
22 |
from utils.st_logs import setup_logging, parse_log_buffer
|
23 |
from utils.workflow_state import WorkflowFSM, FSM_STATES
|
24 |
+
#from classifier.classifier_image import cetacean_classify
|
25 |
+
from classifier.classifier_image import cetacean_just_classify, cetacean_show_results_and_review, cetacean_show_results
|
26 |
+
|
27 |
from classifier.classifier_hotdog import hotdog_classify
|
28 |
|
29 |
|
|
|
231 |
|
232 |
if st.session_state.workflow_fsm.is_in_state('data_entry_complete'):
|
233 |
# can we advance state? - only when the validate button is pressed
|
234 |
+
if st.sidebar.button(":white_check_mark:[**Validate**]"):
|
235 |
# create a dictionary with the submitted observation
|
236 |
tab_log.info(f"{st.session_state.observations}")
|
237 |
df = pd.DataFrame(st.session_state.observations, index=[0])
|
|
|
265 |
revision=classifier_revision,
|
266 |
trust_remote_code=True)
|
267 |
|
268 |
+
cetacean_just_classify(cetacean_classifier)
|
269 |
st.session_state.workflow_fsm.complete_current_state()
|
270 |
+
# trigger a refresh too (refreshhing the prog indicator means the script reruns and
|
271 |
+
# we can enter the next state - visualising the results / review)
|
272 |
+
# ok it doesn't if done programmatically. maybe interacting with teh button? check docs.
|
273 |
+
refresh_progress()
|
274 |
|
275 |
+
elif st.session_state.workflow_fsm.is_in_state('ml_classification_completed'):
|
276 |
# show the results, and allow manual validation
|
277 |
s = ""
|
278 |
for k, v in st.session_state.whale_prediction1.items():
|
|
|
287 |
if st.button("mock: manual validation done."):
|
288 |
st.session_state.workflow_fsm.complete_current_state()
|
289 |
# -> manual_inspection_completed
|
290 |
+
|
291 |
+
cetacean_show_results_and_review()
|
292 |
|
293 |
+
elif st.session_state.workflow_fsm.is_in_state('manual_inspection_completed'):
|
294 |
# show the ML results, and allow the user to upload the observation
|
295 |
st.markdown("""
|
296 |
### Inference Results (after manual validation)
|
|
|
301 |
if st.button("(nooop) Upload observation to THE INTERNET!"):
|
302 |
st.session_state.workflow_fsm.complete_current_state()
|
303 |
# -> data_uploaded
|
304 |
+
|
305 |
+
cetacean_show_results()
|
306 |
|
307 |
+
elif st.session_state.workflow_fsm.is_in_state('data_uploaded'):
|
308 |
# the data has been sent. Lets show the observations again
|
309 |
# but no buttons to upload (or greyed out ok)
|
310 |
st.markdown("""
|