m7mdal7aj commited on
Commit
c791f22
1 Parent(s): 9425e51

Update my_model/tabs/run_inference.py

Browse files
Files changed (1) hide show
  1. my_model/tabs/run_inference.py +8 -2
my_model/tabs/run_inference.py CHANGED
@@ -66,6 +66,7 @@ class InferenceRunner(StateManager):
66
  qa_history = image_data.get('qa_history', [])
67
 
68
  if image_data['analysis_done']:
 
69
  question = nested_col22.text_input(f"Ask a question about this image ({image_key[-11:]}):", key=f'question_{image_key}')
70
  if nested_col22.button('Get Answer', key=f'answer_{image_key}', on_click=self.disable_widgets, disabled=self.is_widget_disabled):
71
 
@@ -109,10 +110,10 @@ class InferenceRunner(StateManager):
109
  if nested_col11.button(st.session_state.button_label, on_click=self.disable_widgets, disabled=self.is_widget_disabled):
110
 
111
  if st.session_state.button_label == "Load Model":
112
- st.session_state['load_button_clicked'] = True
113
  if self.is_model_loaded():
114
  free_gpu_resources()
115
  fine_tuned_model_already_loaded = True
 
116
  else:
117
  load_fine_tuned_model = True
118
  else:
@@ -124,21 +125,26 @@ class InferenceRunner(StateManager):
124
  if load_fine_tuned_model:
125
  free_gpu_resources()
126
  self.load_model()
 
127
 
128
  elif fine_tuned_model_already_loaded:
129
  free_gpu_resources()
130
- self.col1.text("Model already loaded and no settings were changed:)")
 
131
 
132
  elif reload_detection_model:
133
  free_gpu_resources()
134
  self.reload_detection_model()
 
135
 
136
  elif force_reload_full_model:
137
  free_gpu_resources()
138
  self.force_reload_model()
 
139
 
140
  elif st.session_state.method == "In-Context Learning (n-shots)":
141
  self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')
 
142
 
143
 
144
  if self.is_model_loaded():
 
66
  qa_history = image_data.get('qa_history', [])
67
 
68
  if image_data['analysis_done']:
69
+ st.session_state['loading_in_progress'] = False
70
  question = nested_col22.text_input(f"Ask a question about this image ({image_key[-11:]}):", key=f'question_{image_key}')
71
  if nested_col22.button('Get Answer', key=f'answer_{image_key}', on_click=self.disable_widgets, disabled=self.is_widget_disabled):
72
 
 
110
  if nested_col11.button(st.session_state.button_label, on_click=self.disable_widgets, disabled=self.is_widget_disabled):
111
 
112
  if st.session_state.button_label == "Load Model":
 
113
  if self.is_model_loaded():
114
  free_gpu_resources()
115
  fine_tuned_model_already_loaded = True
116
+
117
  else:
118
  load_fine_tuned_model = True
119
  else:
 
125
  if load_fine_tuned_model:
126
  free_gpu_resources()
127
  self.load_model()
128
+ st.session_state['loading_in_progress'] = False
129
 
130
  elif fine_tuned_model_already_loaded:
131
  free_gpu_resources()
132
+ self.col1.text("Model already loaded and no settings were changed:)")
133
+ st.session_state['loading_in_progress'] = False
134
 
135
  elif reload_detection_model:
136
  free_gpu_resources()
137
  self.reload_detection_model()
138
+ st.session_state['loading_in_progress'] = False
139
 
140
  elif force_reload_full_model:
141
  free_gpu_resources()
142
  self.force_reload_model()
143
+ st.session_state['loading_in_progress'] = False
144
 
145
  elif st.session_state.method == "In-Context Learning (n-shots)":
146
  self.col1.warning(f'Model using {st.session_state.method} is not deployed yet, will be ready later.')
147
+ st.session_state['loading_in_progress'] = False
148
 
149
 
150
  if self.is_model_loaded():