m7mdal7aj commited on
Commit
155a844
1 Parent(s): d6c40fa

Update my_model/state_manager.py

Browse files
Files changed (1) hide show
  1. my_model/state_manager.py +4 -1
my_model/state_manager.py CHANGED
@@ -32,6 +32,8 @@ class StateManager:
32
  st.session_state['force_reload_button_clicked'] = False
33
  if 'time_taken_to_load_model' not in st.session_state:
34
  st.session_state['time_taken_to_load_model'] = None
 
 
35
  if "settings_changed" not in st.session_state:
36
  st.session_state['settings_changed'] = self.settings_changed
37
  if 'model_loaded' not in st.session_state:
@@ -232,6 +234,7 @@ class StateManager:
232
 
233
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
234
  st.write("reload func", st.session_state['kbvqa'].detection_confidence )
 
235
  return # only update the confidence level
236
 
237
  prepare_kbvqa_model(only_reload_detection_model=True)
@@ -330,7 +333,7 @@ class StateManager:
330
  detected_objects_str (str): String representation of detected objects.
331
  analysis_done (bool): Flag indicating if analysis of the image is complete.
332
  """
333
- if image_key in st.session_state['images_data']:
334
  st.session_state['images_data'][image_key].update({
335
  'caption': caption,
336
  'detected_objects_str': detected_objects_str,
 
32
  st.session_state['force_reload_button_clicked'] = False
33
  if 'time_taken_to_load_model' not in st.session_state:
34
  st.session_state['time_taken_to_load_model'] = None
35
+ if 'confidence_level_changed' not in st.session_state:
36
+ st.session_state['confidence_level_changed'] = False
37
  if "settings_changed" not in st.session_state:
38
  st.session_state['settings_changed'] = self.settings_changed
39
  if 'model_loaded' not in st.session_state:
 
234
 
235
  st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
236
  st.write("reload func", st.session_state['kbvqa'].detection_confidence )
237
+ st.session_state['confidence_level_changed'] = True
238
  return # only update the confidence level
239
 
240
  prepare_kbvqa_model(only_reload_detection_model=True)
 
333
  detected_objects_str (str): String representation of detected objects.
334
  analysis_done (bool): Flag indicating if analysis of the image is complete.
335
  """
336
+ if image_key in st.session_state['images_data'] or st.session_state["confidence_level_changed"]:
337
  st.session_state['images_data'][image_key].update({
338
  'caption': caption,
339
  'detected_objects_str': detected_objects_str,