Spaces:
Running
Running
Update my_model/utilities/state_manager.py
Browse files
my_model/utilities/state_manager.py
CHANGED
@@ -13,27 +13,28 @@ class StateManager:
|
|
13 |
if 'images_data' not in st.session_state:
|
14 |
st.session_state['images_data'] = {}
|
15 |
if 'method' not in st.session_state:
|
16 |
-
st.
|
17 |
if 'detection_model' not in st.session_state:
|
18 |
-
|
19 |
if 'kbvqa' not in st.session_state:
|
20 |
st.session_state['kbvqa'] = None
|
21 |
-
|
22 |
-
self.default_confidence = 0.2 if self.detection_model == "yolov5" else 0.4
|
23 |
if 'confidence_level' not in st.session_state:
|
24 |
-
|
25 |
-
min_value=0.1,
|
26 |
-
max_value=0.9,
|
27 |
-
value=self.default_confidence,
|
28 |
-
step=0.1,
|
29 |
-
slider_key_name='confidence_level'
|
30 |
-
)
|
31 |
|
32 |
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
def set_slider_value(self, text, min_value, max_value, value, step, slider_key_name):
|
39 |
|
|
|
13 |
if 'images_data' not in st.session_state:
|
14 |
st.session_state['images_data'] = {}
|
15 |
if 'method' not in st.session_state:
|
16 |
+
st.session_state['method'] = None
|
17 |
if 'detection_model' not in st.session_state:
|
18 |
+
st.session_state['detection_model'] = None
|
19 |
if 'kbvqa' not in st.session_state:
|
20 |
st.session_state['kbvqa'] = None
|
|
|
|
|
21 |
if 'confidence_level' not in st.session_state:
|
22 |
+
st.session_state['confidence_level'] = None
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
|
26 |
+
def set_up_widgets(self):
|
27 |
+
st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
|
28 |
+
self.detection_model = st.selectbox("Choose a model for objects detection:", ["yolov5", "detic"], index=1, key='detection_model')
|
29 |
+
default_confidence = 0.2 if self.detection_model == "yolov5" else 0.4
|
30 |
+
self.set_slider_value(text="Select minimum detection confidence level",
|
31 |
+
min_value=0.1,
|
32 |
+
max_value=0.9,
|
33 |
+
value=default_confidence,
|
34 |
+
step=0.1,
|
35 |
+
slider_key_name='confidence_level'
|
36 |
+
)
|
37 |
+
|
38 |
|
39 |
def set_slider_value(self, text, min_value, max_value, value, step, slider_key_name):
|
40 |
|