Update my_model/utilities/state_manager.py
Browse files
my_model/utilities/state_manager.py
CHANGED
@@ -21,16 +21,8 @@ class StateManager:
|
|
21 |
if 'confidence_level' not in st.session_state:
|
22 |
st.session_state['confidence_level'] = None
|
23 |
|
24 |
-
st.text("session state iniializaed")
|
25 |
|
26 |
|
27 |
-
def update_model_settings(self, detection_model=None, confidence_level=None, selected_method=None):
|
28 |
-
if detection_model is not None:
|
29 |
-
st.session_state['model_settings']['detection_model'] = detection_model
|
30 |
-
if confidence_level is not None:
|
31 |
-
st.session_state['model_settings']['confidence_level'] = confidence_level
|
32 |
-
if selected_method is not None:
|
33 |
-
st.session_state['model_settings']['selected_method'] = selected_method
|
34 |
|
35 |
def set_slider_value(self, text, min_value, max_value, value, step, slider_key_name):
|
36 |
|
@@ -79,7 +71,7 @@ class StateManager:
|
|
79 |
if self.is_model_loaded():
|
80 |
prepare_kbvqa_model(detection_model, only_reload_detection_model=True)
|
81 |
st.session_state['kbvqa'].detection_confidence = confidence_level
|
82 |
-
self.update_model_settings(detection_model, confidence_level)
|
83 |
free_gpu_resources()
|
84 |
except Exception as e:
|
85 |
st.error(f"Error reloading detection model: {e}")
|
|
|
21 |
if 'confidence_level' not in st.session_state:
|
22 |
st.session_state['confidence_level'] = None
|
23 |
|
|
|
24 |
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
def set_slider_value(self, text, min_value, max_value, value, step, slider_key_name):
|
28 |
|
|
|
71 |
if self.is_model_loaded():
|
72 |
prepare_kbvqa_model(detection_model, only_reload_detection_model=True)
|
73 |
st.session_state['kbvqa'].detection_confidence = confidence_level
|
74 |
+
#self.update_model_settings(detection_model, confidence_level)
|
75 |
free_gpu_resources()
|
76 |
except Exception as e:
|
77 |
st.error(f"Error reloading detection model: {e}")
|