Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
@@ -221,7 +221,13 @@ class StateManager:
|
|
221 |
try:
|
222 |
free_gpu_resources()
|
223 |
if self.is_model_loaded:
|
224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
prepare_kbvqa_model(only_reload_detection_model=True)
|
226 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
227 |
self.col1.success("Model reloaded with updated settings and ready for inference.")
|
|
|
221 |
try:
|
222 |
free_gpu_resources()
|
223 |
if self.is_model_loaded:
|
224 |
+
|
225 |
+
if st.session_state['detection_model'] == st.session_state['previous_state']['detection_model']\
|
226 |
+
and st.session_state['method'] == st.session_state['previous_state']['method'] \
|
227 |
+
and st.session_state['confidence_level'] != st.session_state['confidence_level']['method']:
|
228 |
+
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
229 |
+
return # only update the confidence level
|
230 |
+
|
231 |
prepare_kbvqa_model(only_reload_detection_model=True)
|
232 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
233 |
self.col1.success("Model reloaded with updated settings and ready for inference.")
|