Update my_model/tabs/run_inference.py
Browse files
my_model/tabs/run_inference.py
CHANGED
@@ -96,21 +96,29 @@ def process_new_image(image_key, image, kbvqa):
|
|
96 |
def run_inference():
|
97 |
st.title("Run Inference")
|
98 |
|
99 |
-
|
100 |
-
|
101 |
default_confidence = 0.2 if detection_model == "yolov5" else 0.4
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
105 |
|
106 |
|
107 |
-
|
108 |
-
|
|
|
109 |
|
110 |
if method == "Fine-Tuned Model":
|
111 |
if st.button(button_label):
|
112 |
-
if
|
113 |
-
|
114 |
st.write("Model already loaded.")
|
115 |
else:
|
116 |
st.text("Loading the model, please wait...")
|
|
|
96 |
def run_inference():
|
97 |
st.title("Run Inference")
|
98 |
|
99 |
+
st.selectbox("Choose a method:", ["Fine-Tuned Model", "In-Context Learning (n-shots)"], index=0, key='method')
|
100 |
+
st.selectbox("Choose a model for objects detection:", ["yolov5", "detic"], index=1, key='detection_model')
|
101 |
default_confidence = 0.2 if detection_model == "yolov5" else 0.4
|
102 |
+
# confidence_level = st.slider("Select minimum detection confidence level", min_value=0.1, max_value=0.9, value=default_confidence, step=0.1)
|
103 |
+
state_manager.set_slider_value(text="Select minimum detection confidence level",
|
104 |
+
min_value=0.1,
|
105 |
+
max_value=0.9,
|
106 |
+
value=default_confidence,
|
107 |
+
step=0.1,
|
108 |
+
slider_key_name='confidence_level',
|
109 |
+
)
|
110 |
|
111 |
+
# state_manager.update_model_settings(detection_model=detection_model, confidence_level=confidence_level, selected_method=method)
|
112 |
|
113 |
|
114 |
+
# need_model_reload = state_manager.check_settings_changed(method, detection_model, confidence_level) and state_manager.is_model_loaded()
|
115 |
+
need_model_reload =
|
116 |
+
button_label = "Reload Model" if st.session_state['kbvqa'] else "Load Model"
|
117 |
|
118 |
if method == "Fine-Tuned Model":
|
119 |
if st.button(button_label):
|
120 |
+
if button_label == "Load Model" and :
|
121 |
+
# st write(st.session_state['kbvqa'])
|
122 |
st.write("Model already loaded.")
|
123 |
else:
|
124 |
st.text("Loading the model, please wait...")
|