Spaces:
Build error
Build error
rmm commited on
Commit ·
774a646
1
Parent(s): 5a3cbc4
chore: moved debug function to relevant module, and docstring
Browse files- src/input/input_handling.py +22 -0
- src/main.py +3 -16
src/input/input_handling.py
CHANGED
|
@@ -391,3 +391,25 @@ def add_input_UI_elements() -> None:
|
|
| 391 |
container_metadata_inputs = st.container(border=True, key="container_metadata_inputs_id")
|
| 392 |
container_metadata_inputs.write("Metadata Inputs... wait for file upload ")
|
| 393 |
st.session_state.container_metadata_inputs = container_metadata_inputs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
container_metadata_inputs = st.container(border=True, key="container_metadata_inputs_id")
|
| 392 |
container_metadata_inputs.write("Metadata Inputs... wait for file upload ")
|
| 393 |
st.session_state.container_metadata_inputs = container_metadata_inputs
|
| 394 |
+
|
| 395 |
+
|
| 396 |
+
def dbg_show_observation_hashes():
|
| 397 |
+
"""
|
| 398 |
+
Displays information about each observation including the hash
|
| 399 |
+
|
| 400 |
+
- debug usage, keeping track of the hashes and persistence of the InputObservations.
|
| 401 |
+
- it renders text to the current container, not intended for final app.
|
| 402 |
+
|
| 403 |
+
"""
|
| 404 |
+
|
| 405 |
+
# a debug: we seem to be losing the whale classes?
|
| 406 |
+
st.write(f"[D] num observations: {len(st.session_state.observations)}")
|
| 407 |
+
s = ""
|
| 408 |
+
for hash in st.session_state.observations.keys():
|
| 409 |
+
obs = st.session_state.observations[hash]
|
| 410 |
+
s += f"- [D] observation {hash} ({obs._inst_id}) has {len(obs.top_predictions)} predictions\n"
|
| 411 |
+
#s += f" - {repr(obs)}\n" # check the str / repr method
|
| 412 |
+
|
| 413 |
+
#print(obs)
|
| 414 |
+
|
| 415 |
+
st.markdown(s)
|
src/main.py
CHANGED
|
@@ -18,6 +18,7 @@ import whale_gallery as gallery
|
|
| 18 |
import whale_viewer as viewer
|
| 19 |
from input.input_handling import setup_input, check_inputs_are_set
|
| 20 |
from input.input_handling import init_input_container_states, add_input_UI_elements, init_input_data_session_states
|
|
|
|
| 21 |
|
| 22 |
from maps.alps_map import present_alps_map
|
| 23 |
from maps.obs_map import present_obs_map
|
|
@@ -26,10 +27,7 @@ from utils.workflow_state import WorkflowFSM, FSM_STATES
|
|
| 26 |
from utils.workflow_ui import refresh_progress, init_workflow_viz
|
| 27 |
from hf_push_observations import push_all_observations
|
| 28 |
|
| 29 |
-
|
| 30 |
-
#from classifier.classifier_image import cetacean_classify
|
| 31 |
from classifier.classifier_image import cetacean_just_classify, cetacean_show_results_and_review, cetacean_show_results
|
| 32 |
-
|
| 33 |
from classifier.classifier_hotdog import hotdog_classify
|
| 34 |
|
| 35 |
|
|
@@ -82,19 +80,8 @@ init_input_container_states()
|
|
| 82 |
init_workflow_viz()
|
| 83 |
|
| 84 |
|
| 85 |
-
|
| 86 |
-
def dbg_show_obs_hashes():
|
| 87 |
-
# a debug: we seem to be losing the whale classes?
|
| 88 |
-
st.write(f"[D] num observations: {len(st.session_state.observations)}")
|
| 89 |
-
s = ""
|
| 90 |
-
for hash in st.session_state.observations.keys():
|
| 91 |
-
obs = st.session_state.observations[hash]
|
| 92 |
-
s += f"- [D] observation {hash} ({obs._inst_id}) has {len(obs.top_predictions)} predictions\n"
|
| 93 |
-
#s += f" - {repr(obs)}\n" # check the str / repr method
|
| 94 |
-
|
| 95 |
-
#print(obs)
|
| 96 |
|
| 97 |
-
|
| 98 |
|
| 99 |
|
| 100 |
def main() -> None:
|
|
@@ -256,7 +243,7 @@ def main() -> None:
|
|
| 256 |
with tab_inference:
|
| 257 |
|
| 258 |
if st.session_state.MODE_DEV_STATEFUL:
|
| 259 |
-
|
| 260 |
|
| 261 |
add_classifier_header()
|
| 262 |
# if we are before data_entry_validated, show the button, disabled.
|
|
|
|
| 18 |
import whale_viewer as viewer
|
| 19 |
from input.input_handling import setup_input, check_inputs_are_set
|
| 20 |
from input.input_handling import init_input_container_states, add_input_UI_elements, init_input_data_session_states
|
| 21 |
+
from input.input_handling import dbg_show_observation_hashes
|
| 22 |
|
| 23 |
from maps.alps_map import present_alps_map
|
| 24 |
from maps.obs_map import present_obs_map
|
|
|
|
| 27 |
from utils.workflow_ui import refresh_progress, init_workflow_viz
|
| 28 |
from hf_push_observations import push_all_observations
|
| 29 |
|
|
|
|
|
|
|
| 30 |
from classifier.classifier_image import cetacean_just_classify, cetacean_show_results_and_review, cetacean_show_results
|
|
|
|
| 31 |
from classifier.classifier_hotdog import hotdog_classify
|
| 32 |
|
| 33 |
|
|
|
|
| 80 |
init_workflow_viz()
|
| 81 |
|
| 82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
+
|
| 85 |
|
| 86 |
|
| 87 |
def main() -> None:
|
|
|
|
| 243 |
with tab_inference:
|
| 244 |
|
| 245 |
if st.session_state.MODE_DEV_STATEFUL:
|
| 246 |
+
dbg_show_observation_hashes()
|
| 247 |
|
| 248 |
add_classifier_header()
|
| 249 |
# if we are before data_entry_validated, show the button, disabled.
|