m7mdal7aj commited on
Commit
12f08dc
1 Parent(s): 040bb8d

Update my_model/utilities/state_manager.py

Browse files
my_model/utilities/state_manager.py CHANGED
@@ -8,12 +8,13 @@ from my_model.KBVQA import KBVQA, prepare_kbvqa_model
8
  class StateManager:
9
 
10
  def initialize_state(self):
 
11
  if 'images_data' not in st.session_state:
12
  st.session_state['images_data'] = {}
13
  if 'kbvqa' not in st.session_state:
14
  st.session_state['kbvqa'] = None
15
- if "button_lablel" not in st.session_state:
16
- st.session_state['button_lablel'] = "Load Model"
17
  if "previous_state" not in st.session_state:
18
  st.session_state['previous_state'] = {}
19
 
@@ -58,7 +59,7 @@ class StateManager:
58
  #self.update_model_settings(detection_model, confidence_level)
59
  # Update the previous state with current session state values
60
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
61
- st.session_state['button_lablel'] = "Reload Model"
62
  free_gpu_resources()
63
  except Exception as e:
64
  st.error(f"Error loading model: {e}")
 
8
  class StateManager:
9
 
10
  def initialize_state(self):
11
+ st.text('states initialized')
12
  if 'images_data' not in st.session_state:
13
  st.session_state['images_data'] = {}
14
  if 'kbvqa' not in st.session_state:
15
  st.session_state['kbvqa'] = None
16
+ if "button_label" not in st.session_state:
17
+ st.session_state['button_label'] = "Load Model"
18
  if "previous_state" not in st.session_state:
19
  st.session_state['previous_state'] = {}
20
 
 
59
  #self.update_model_settings(detection_model, confidence_level)
60
  # Update the previous state with current session state values
61
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
62
+ st.session_state['button_label'] = "Reload Model"
63
  free_gpu_resources()
64
  except Exception as e:
65
  st.error(f"Error loading model: {e}")