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

Update my_model/tabs/run_inference.py

Browse files
Files changed (1) hide show
  1. my_model/tabs/run_inference.py +4 -4
my_model/tabs/run_inference.py CHANGED
@@ -101,15 +101,15 @@ def run_inference():
101
  default_confidence = 0.2 if detection_model == "yolov5" else 0.4
102
  confidence_level = st.slider("Select minimum detection confidence level", min_value=0.1, max_value=0.9, value=default_confidence, step=0.1)
103
 
104
- state_manager.update_model_settings(detection_model, confidence_level, method)
105
- settings_changed = state_manager.check_settings_changed(method, detection_model, confidence_level)
106
 
107
- need_model_reload = settings_changed and state_manager.is_model_loaded()
 
108
  button_label = "Reload Model" if need_model_reload else "Load Model"
109
 
110
  if method == "Fine-Tuned Model":
111
  if st.button(button_label):
112
- if state_manager.is_model_loaded() and not settings_changed:
113
  st.write("Model already loaded.")
114
  else:
115
  st.text("Loading the model, please wait...")
 
101
  default_confidence = 0.2 if detection_model == "yolov5" else 0.4
102
  confidence_level = st.slider("Select minimum detection confidence level", min_value=0.1, max_value=0.9, value=default_confidence, step=0.1)
103
 
104
+ state_manager.update_model_settings(detection_model=detection_model, confidence_level=confidence_level, selected_method=method)
 
105
 
106
+
107
+ need_model_reload = state_manager.check_settings_changed(method, detection_model, confidence_level) and state_manager.is_model_loaded()
108
  button_label = "Reload Model" if need_model_reload else "Load Model"
109
 
110
  if method == "Fine-Tuned Model":
111
  if st.button(button_label):
112
+ if not need_model_reload:
113
  st.write("Model already loaded.")
114
  else:
115
  st.text("Loading the model, please wait...")