m7mdal7aj commited on
Commit
87db907
1 Parent(s): 33dd05f

Update my_model/tabs/run_inference.py

Browse files
Files changed (1) hide show
  1. my_model/tabs/run_inference.py +6 -1
my_model/tabs/run_inference.py CHANGED
@@ -241,8 +241,10 @@ class InferenceRunner(StateManager):
241
 
242
  load_fine_tuned_model = False
243
  fine_tuned_model_already_loaded = False
 
244
  reload_detection_model = False
245
  force_reload_full_model = False
 
246
 
247
  if self.is_model_loaded and self.settings_changed:
248
  self.col1.warning("Model settings have changed, please reload the model, this will take a second .. ")
@@ -267,7 +269,10 @@ class InferenceRunner(StateManager):
267
  fine_tuned_model_already_loaded = True
268
  else:
269
  load_fine_tuned_model = True
270
- else:
 
 
 
271
  reload_detection_model = True
272
  if nested_col12.button("Force Reload", on_click=self.disable_widgets,
273
  disabled=self.is_widget_disabled):
 
241
 
242
  load_fine_tuned_model = False
243
  fine_tuned_model_already_loaded = False
244
+ reload_kbvqa = False
245
  reload_detection_model = False
246
  force_reload_full_model = False
247
+
248
 
249
  if self.is_model_loaded and self.settings_changed:
250
  self.col1.warning("Model settings have changed, please reload the model, this will take a second .. ")
 
269
  fine_tuned_model_already_loaded = True
270
  else:
271
  load_fine_tuned_model = True
272
+ elif st.session_state.button_label == "Reload Model"
273
+ and st.session_state['method'] != st.session_state['previous_state']['method']: # check if the model size have changed
274
+ force_reload_full_model = True
275
+ elif self.is_model_loaded and st.session_state.kbvqa.detection_model != st.session_state['detection_model']):
276
  reload_detection_model = True
277
  if nested_col12.button("Force Reload", on_click=self.disable_widgets,
278
  disabled=self.is_widget_disabled):