m7mdal7aj commited on
Commit
1b71503
1 Parent(s): a696a1a

Update my_model/utilities/state_manager.py

Browse files
Files changed (1) hide show
  1. my_model/utilities/state_manager.py +15 -14
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.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
17
  if 'detection_model' not in st.session_state:
18
- self.detection_model = st.selectbox("Choose a model for objects detection:", ["yolov5", "detic"], index=1, key='detection_model')
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
- self.set_slider_value(text="Select minimum detection confidence level",
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
- # confidence_level = st.slider("Select minimum detection confidence level", min_value=0.1, max_value=0.9, value=default_confidence, step=0.1)
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