Update my_model/state_manager.py
Browse files
my_model/state_manager.py
CHANGED
@@ -22,12 +22,9 @@ class StateManager:
|
|
22 |
|
23 |
|
24 |
def set_up_widgets(self):
|
|
|
25 |
# Create two columns with different widths
|
26 |
col1, col2 = st.columns([0.8, 0.2]) # Adjust the ratio as needed
|
27 |
-
|
28 |
-
# Use the second column (col2) for the checkbox
|
29 |
-
|
30 |
-
|
31 |
with col1:
|
32 |
st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
|
33 |
detection_model = st.selectbox("Choose a model for objects detection:", ["yolov5", "detic"], index=1, key='detection_model')
|
@@ -68,7 +65,7 @@ class StateManager:
|
|
68 |
free_gpu_resources()
|
69 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
70 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
71 |
-
|
72 |
# Update the previous state with current session state values
|
73 |
st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
|
74 |
|
@@ -104,7 +101,7 @@ class StateManager:
|
|
104 |
except Exception as e:
|
105 |
st.error(f"Error reloading detection model: {e}")
|
106 |
|
107 |
-
|
108 |
def process_new_image(self, image_key, image, kbvqa):
|
109 |
if image_key not in st.session_state['images_data']:
|
110 |
st.session_state['images_data'][image_key] = {
|
|
|
22 |
|
23 |
|
24 |
def set_up_widgets(self):
|
25 |
+
|
26 |
# Create two columns with different widths
|
27 |
col1, col2 = st.columns([0.8, 0.2]) # Adjust the ratio as needed
|
|
|
|
|
|
|
|
|
28 |
with col1:
|
29 |
st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
|
30 |
detection_model = st.selectbox("Choose a model for objects detection:", ["yolov5", "detic"], index=1, key='detection_model')
|
|
|
65 |
free_gpu_resources()
|
66 |
st.session_state['kbvqa'] = prepare_kbvqa_model()
|
67 |
st.session_state['kbvqa'].detection_confidence = st.session_state.confidence_level
|
68 |
+
|
69 |
# Update the previous state with current session state values
|
70 |
st.session_state['previous_state'] = {'method': st.session_state.method, 'detection_model': st.session_state.detection_model, 'confidence_level': st.session_state.confidence_level}
|
71 |
|
|
|
101 |
except Exception as e:
|
102 |
st.error(f"Error reloading detection model: {e}")
|
103 |
|
104 |
+
|
105 |
def process_new_image(self, image_key, image, kbvqa):
|
106 |
if image_key not in st.session_state['images_data']:
|
107 |
st.session_state['images_data'][image_key] = {
|