Spaces:
Sleeping
Sleeping
Update my_model/tabs/run_inference.py
Browse files- my_model/tabs/run_inference.py +16 -12
my_model/tabs/run_inference.py
CHANGED
@@ -84,20 +84,24 @@ class InferenceRunner(StateManager):
|
|
84 |
st.session_state.button_label = "Reload Model" if self.is_model_loaded() and self.settings_changed else "Load Model"
|
85 |
|
86 |
if st.session_state.method == "Fine-Tuned Model":
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
self.
|
|
|
|
|
|
|
|
|
|
|
92 |
else:
|
93 |
free_gpu_resources()
|
94 |
-
self.
|
95 |
-
|
|
|
|
|
|
|
96 |
free_gpu_resources()
|
97 |
-
self.
|
98 |
-
|
99 |
-
if self.is_model_loaded() and st.session_state.kbvqa.all_models_loaded:
|
100 |
-
free_gpu_resources()
|
101 |
-
self.image_qa_app(self.get_model())
|
102 |
else:
|
103 |
self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')
|
|
|
84 |
st.session_state.button_label = "Reload Model" if self.is_model_loaded() and self.settings_changed else "Load Model"
|
85 |
|
86 |
if st.session_state.method == "Fine-Tuned Model":
|
87 |
+
with st.container():
|
88 |
+
nested_col11, nested_col12 = st.columns([0.5, 0.5])
|
89 |
+
if nested_col11.button(st.session_state.button_label):
|
90 |
+
if st.session_state.button_label == "Load Model":
|
91 |
+
if self.is_model_loaded():
|
92 |
+
free_gpu_resources()
|
93 |
+
self.col1.text("Model already loaded and no settings were changed:)")
|
94 |
+
else:
|
95 |
+
free_gpu_resources()
|
96 |
+
self.load_model()
|
97 |
else:
|
98 |
free_gpu_resources()
|
99 |
+
self.reload_detection_model()
|
100 |
+
if nested_col12.button("Force Reload"):
|
101 |
+
force_reload_model()
|
102 |
+
|
103 |
+
if self.is_model_loaded() and st.session_state.kbvqa.all_models_loaded:
|
104 |
free_gpu_resources()
|
105 |
+
self.image_qa_app(self.get_model())
|
|
|
|
|
|
|
|
|
106 |
else:
|
107 |
self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')
|