Update my_model/tabs/run_inference.py
Browse files
my_model/tabs/run_inference.py
CHANGED
@@ -99,36 +99,22 @@ def run_inference():
|
|
99 |
state_manager.initialize_state()
|
100 |
state_manager.set_up_widgets()
|
101 |
# state_manager.display_session_state()
|
102 |
-
|
103 |
state_manager.display_model_settings()
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
# need_model_reload = state_manager.check_settings_changed(method, detection_model, confidence_level) and state_manager.is_model_loaded()
|
108 |
-
|
109 |
-
|
110 |
-
button_label = "Reload Model" if st.session_state['kbvqa'] is not None else "Load Model"
|
111 |
-
|
112 |
if st.session_state.method == "Fine-Tuned Model":
|
113 |
if st.button(button_label):
|
114 |
if button_label == "Load Model" and state_manager.is_model_loaded():
|
115 |
-
# st write(st.session_state['kbvqa'])
|
116 |
st.write("stop playing around :):)P:)")
|
117 |
-
st.
|
118 |
else:
|
119 |
-
|
120 |
-
state_manager.load_model()
|
121 |
st.write("Model is ready for inference.")
|
122 |
-
|
123 |
if state_manager.is_model_loaded():
|
124 |
-
|
125 |
image_qa_app(state_manager.get_model())
|
126 |
-
|
127 |
else:
|
128 |
st.write('Model is not ready yet, will be updated later.')
|
129 |
|
130 |
|
131 |
-
|
132 |
def display_model_settings():
|
133 |
st.write("### Current Model Settings:")
|
134 |
st.table(pd.DataFrame(st.session_state['model_settings'], index=[0]))
|
|
|
99 |
state_manager.initialize_state()
|
100 |
state_manager.set_up_widgets()
|
101 |
# state_manager.display_session_state()
|
|
|
102 |
state_manager.display_model_settings()
|
103 |
+
button_label = "Reload Model" if state_manager.is_model_loaded() and state_manager.has_state_changed() else "Load Model"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
if st.session_state.method == "Fine-Tuned Model":
|
105 |
if st.button(button_label):
|
106 |
if button_label == "Load Model" and state_manager.is_model_loaded():
|
|
|
107 |
st.write("stop playing around :):)P:)")
|
108 |
+
st.text("Model already loaded.")
|
109 |
else:
|
110 |
+
state_manager.reload_detection_model()
|
|
|
111 |
st.write("Model is ready for inference.")
|
|
|
112 |
if state_manager.is_model_loaded():
|
|
|
113 |
image_qa_app(state_manager.get_model())
|
|
|
114 |
else:
|
115 |
st.write('Model is not ready yet, will be updated later.')
|
116 |
|
117 |
|
|
|
118 |
def display_model_settings():
|
119 |
st.write("### Current Model Settings:")
|
120 |
st.table(pd.DataFrame(st.session_state['model_settings'], index=[0]))
|