m7mdal7aj commited on
Commit
2957e90
1 Parent(s): 407f69f

Update my_model/utilities/state_manager.py

Browse files
my_model/utilities/state_manager.py CHANGED
@@ -13,11 +13,10 @@ class StateManager:
13
  if 'images_data' not in st.session_state:
14
  st.session_state['images_data'] = {}
15
  if 'model_settings' not in st.session_state:
16
- st.session_state['model_settings'] = {'detection_model': None, 'confidence_level': None}
17
  if 'kbvqa' not in st.session_state:
18
  st.session_state['kbvqa'] = None
19
- if 'selected_method' not in st.session_state:
20
- st.session_state['selected_method'] = None
21
 
22
  def update_model_settings(self, detection_model=None, confidence_level=None, selected_method=None):
23
  if detection_model is not None:
@@ -25,12 +24,12 @@ class StateManager:
25
  if confidence_level is not None:
26
  st.session_state['model_settings']['confidence_level'] = confidence_level
27
  if selected_method is not None:
28
- st.session_state['selected_method'] = selected_method
29
 
30
  def check_settings_changed(self, current_selected_method, current_detection_model, current_confidence_level):
31
  return (st.session_state['model_settings']['detection_model'] != current_detection_model or
32
  st.session_state['model_settings']['confidence_level'] != current_confidence_level or
33
- st.session_state['selected_method'] != current_selected_method)
34
 
35
  def display_model_settings(self):
36
  st.write("### Current Model Settings:")
 
13
  if 'images_data' not in st.session_state:
14
  st.session_state['images_data'] = {}
15
  if 'model_settings' not in st.session_state:
16
+ st.session_state['model_settings'] = {'selected_method': None, 'detection_model': None, 'confidence_level': None}
17
  if 'kbvqa' not in st.session_state:
18
  st.session_state['kbvqa'] = None
19
+
 
20
 
21
  def update_model_settings(self, detection_model=None, confidence_level=None, selected_method=None):
22
  if detection_model is not None:
 
24
  if confidence_level is not None:
25
  st.session_state['model_settings']['confidence_level'] = confidence_level
26
  if selected_method is not None:
27
+ st.session_state['model_settings']['selected_method'] = selected_method
28
 
29
  def check_settings_changed(self, current_selected_method, current_detection_model, current_confidence_level):
30
  return (st.session_state['model_settings']['detection_model'] != current_detection_model or
31
  st.session_state['model_settings']['confidence_level'] != current_confidence_level or
32
+ st.session_state['model_settings']['selected_method'] != current_selected_method)
33
 
34
  def display_model_settings(self):
35
  st.write("### Current Model Settings:")