rmm commited on
Commit
14b60f7
·
1 Parent(s): 32091bb

chore: remove unused and debug code

Browse files
Files changed (1) hide show
  1. src/input/input_handling.py +1 -24
src/input/input_handling.py CHANGED
@@ -5,7 +5,7 @@ import hashlib
5
  import os
6
 
7
  import streamlit as st
8
- from streamlit.delta_generator import DeltaGenerator
9
  from streamlit.runtime.uploaded_file_manager import UploadedFile
10
 
11
  import cv2
@@ -17,13 +17,6 @@ from input.input_validator import get_image_datetime, is_valid_email, is_valid_n
17
  m_logger = logging.getLogger(__name__)
18
  m_logger.setLevel(logging.INFO)
19
 
20
- OKGREEN = '\033[92m'
21
- ENDC = '\033[0m'
22
- def _cprint(msg:str, color:str=OKGREEN):
23
- """Print colored message"""
24
- print(f"{color}{msg}{ENDC}")
25
-
26
-
27
  '''
28
  A module to setup the input handling for the whale observation guidance tool
29
 
@@ -249,7 +242,6 @@ def metadata_inputs_one_file(file:UploadedFile, image_hash:str, dbg_ix:int=0) ->
249
 
250
  image = st.session_state.images.get(image_hash, None)
251
  # add the UI elements
252
- #viewcontainer.title(f"Metadata for {filename}")
253
  viewcontainer = _viewcontainer.expander(f"Metadata for {file.name}", expanded=True)
254
 
255
 
@@ -278,7 +270,6 @@ def metadata_inputs_one_file(file:UploadedFile, image_hash:str, dbg_ix:int=0) ->
278
  st.session_state[key_lat] = latitude
279
  st.session_state[key_lon] = longitude
280
 
281
-
282
 
283
  # 5. Date/time
284
  ## first from state, if previously set/modified
@@ -318,8 +309,6 @@ def metadata_inputs_one_file(file:UploadedFile, image_hash:str, dbg_ix:int=0) ->
318
  dt = datetime.datetime.now().astimezone().replace(microsecond=0)
319
  time_value = dt.time()
320
  date_value = dt.date()
321
-
322
-
323
 
324
  ## either way, give user the option to enter manually (or correct, e.g. if camera has no rtc clock)
325
  date = viewcontainer.date_input(
@@ -331,15 +320,10 @@ def metadata_inputs_one_file(file:UploadedFile, image_hash:str, dbg_ix:int=0) ->
331
  key=f"input_time_anchor_{image_hash}",
332
  disabled=st.session_state.get("input_disabled", False),)
333
 
334
- #v1 = st.session_state.get(key_date, None)
335
- #v2 = st.session_state.get(key_time, None)
336
- #_cprint(f"[DD] date, time: {type(date)}, {type(time)}. {type(v1)}, {type(v2)}. {v1}, {v2}")
337
-
338
  # now store the date and time into the session state (persists across page switches)
339
  st.session_state[key_date] = date
340
  st.session_state[key_time] = time
341
 
342
-
343
  tz_str = dt.strftime('%z') # this is numeric, otherwise the info isn't consistent.
344
 
345
  observation = InputObservation(image=image, latitude=latitude, longitude=longitude,
@@ -410,8 +394,6 @@ def _setup_oneoff_inputs() -> None:
410
  author_email = st.text_input("Author Email",
411
  value=st.session_state.get("input_author_email", None),
412
  disabled=st.session_state.get("input_disabled", False),
413
- #spoof_metadata.get('author_email', ""),
414
- #key="input_author_email")
415
  )
416
  # store the email in session state
417
  st.session_state["input_author_email"] = author_email
@@ -427,11 +409,6 @@ def _setup_oneoff_inputs() -> None:
427
  key="file_uploader_data", on_change=buffer_uploaded_files)
428
 
429
 
430
-
431
-
432
-
433
-
434
-
435
  def setup_input() -> None:
436
  '''
437
  Set up the user input handling (files and metadata)
 
5
  import os
6
 
7
  import streamlit as st
8
+ #from streamlit.delta_generator import DeltaGenerator
9
  from streamlit.runtime.uploaded_file_manager import UploadedFile
10
 
11
  import cv2
 
17
  m_logger = logging.getLogger(__name__)
18
  m_logger.setLevel(logging.INFO)
19
 
 
 
 
 
 
 
 
20
  '''
21
  A module to setup the input handling for the whale observation guidance tool
22
 
 
242
 
243
  image = st.session_state.images.get(image_hash, None)
244
  # add the UI elements
 
245
  viewcontainer = _viewcontainer.expander(f"Metadata for {file.name}", expanded=True)
246
 
247
 
 
270
  st.session_state[key_lat] = latitude
271
  st.session_state[key_lon] = longitude
272
 
 
273
 
274
  # 5. Date/time
275
  ## first from state, if previously set/modified
 
309
  dt = datetime.datetime.now().astimezone().replace(microsecond=0)
310
  time_value = dt.time()
311
  date_value = dt.date()
 
 
312
 
313
  ## either way, give user the option to enter manually (or correct, e.g. if camera has no rtc clock)
314
  date = viewcontainer.date_input(
 
320
  key=f"input_time_anchor_{image_hash}",
321
  disabled=st.session_state.get("input_disabled", False),)
322
 
 
 
 
 
323
  # now store the date and time into the session state (persists across page switches)
324
  st.session_state[key_date] = date
325
  st.session_state[key_time] = time
326
 
 
327
  tz_str = dt.strftime('%z') # this is numeric, otherwise the info isn't consistent.
328
 
329
  observation = InputObservation(image=image, latitude=latitude, longitude=longitude,
 
394
  author_email = st.text_input("Author Email",
395
  value=st.session_state.get("input_author_email", None),
396
  disabled=st.session_state.get("input_disabled", False),
 
 
397
  )
398
  # store the email in session state
399
  st.session_state["input_author_email"] = author_email
 
409
  key="file_uploader_data", on_change=buffer_uploaded_files)
410
 
411
 
 
 
 
 
 
412
  def setup_input() -> None:
413
  '''
414
  Set up the user input handling (files and metadata)