m7mdal7aj commited on
Commit
6307a2e
1 Parent(s): 77f9d5b

Update my_model/utilities/state_manager.py

Browse files
my_model/utilities/state_manager.py CHANGED
@@ -8,7 +8,6 @@ from my_model.KBVQA import KBVQA, prepare_kbvqa_model
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:
@@ -51,13 +50,14 @@ class StateManager:
51
  """Load the KBVQA model with specified settings."""
52
  try:
53
  free_gpu_resources()
54
- st.text("Loading the model, this should take no more than a few minutes, please wait...")
55
  st.session_state['kbvqa'] = prepare_kbvqa_model()
56
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
57
  #self.update_model_settings(detection_model, confidence_level)
58
  # Update the previous state with current session state values
59
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
 
60
  st.session_state['button_label'] = "Reload Model"
 
61
  free_gpu_resources()
62
  except Exception as e:
63
  st.error(f"Error loading model: {e}")
 
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:
 
50
  """Load the KBVQA model with specified settings."""
51
  try:
52
  free_gpu_resources()
 
53
  st.session_state['kbvqa'] = prepare_kbvqa_model()
54
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
55
  #self.update_model_settings(detection_model, confidence_level)
56
  # Update the previous state with current session state values
57
  st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
58
+
59
  st.session_state['button_label'] = "Reload Model"
60
+ st.text('button changed')
61
  free_gpu_resources()
62
  except Exception as e:
63
  st.error(f"Error loading model: {e}")