Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
@@ -136,10 +136,14 @@ class StateManager:
|
|
136 |
|
137 |
def force_reload_model(self):
|
138 |
try:
|
|
|
139 |
self.delete_model()
|
|
|
140 |
self.initialize_state()
|
|
|
141 |
free_gpu_resources()
|
142 |
st.session_state['kbvqa'] = prepare_kbvqa_model(force_reload=True)
|
|
|
143 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
144 |
# Update the previous state with current session state values
|
145 |
st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
|
@@ -160,6 +164,7 @@ class StateManager:
|
|
160 |
del st.session_state['kbvqa']
|
161 |
st.write('Model deleted')
|
162 |
free_gpu_resources()
|
|
|
163 |
free_gpu_resources()
|
164 |
|
165 |
|
|
|
136 |
|
137 |
def force_reload_model(self):
|
138 |
try:
|
139 |
+
st.text("CCCCCC")
|
140 |
self.delete_model()
|
141 |
+
st.text("BBBBB")
|
142 |
self.initialize_state()
|
143 |
+
st.text("DDDD")
|
144 |
free_gpu_resources()
|
145 |
st.session_state['kbvqa'] = prepare_kbvqa_model(force_reload=True)
|
146 |
+
st.text("EEEEE")
|
147 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
148 |
# Update the previous state with current session state values
|
149 |
st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
|
|
|
164 |
del st.session_state['kbvqa']
|
165 |
st.write('Model deleted')
|
166 |
free_gpu_resources()
|
167 |
+
st.text("AAAAAA")
|
168 |
free_gpu_resources()
|
169 |
|
170 |
|