m7mdal7aj commited on
Commit
6d0a61c
1 Parent(s): c690614

Update my_model/tabs/run_inference.py

Browse files
Files changed (1) hide show
  1. my_model/tabs/run_inference.py +3 -17
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
- # state_manager.update_model_settings(detection_model=detection_model, confidence_level=confidence_level, selected_method=method)
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.write("Model already loaded.")
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]))