m7mdal7aj commited on
Commit
450d7b7
1 Parent(s): b491c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -130,10 +130,12 @@ def run_inference():
130
  settings_changed = (st.session_state['model_settings']['detection_model'] != detection_model or
131
  st.session_state['model_settings']['confidence_level'] != confidence_level)
132
 
133
- if settings_changed:
 
 
134
  st.text("Model Settings have changed, please reload the model, this will take no time :)")
135
 
136
- button_label = "Reload Model" if settings_changed else "Load Model"
137
 
138
  if method == "Fine-Tuned Model":
139
  if 'kbvqa' not in st.session_state:
@@ -166,7 +168,7 @@ def run_inference():
166
  image_qa_app(st.session_state['kbvqa'])
167
 
168
  else:
169
- st.write('Model is not ready for inference yet')
170
 
171
  # Display model settings
172
  if 'kbvqa' in st.session_state and st.session_state['kbvqa'] is not None:
 
130
  settings_changed = (st.session_state['model_settings']['detection_model'] != detection_model or
131
  st.session_state['model_settings']['confidence_level'] != confidence_level)
132
 
133
+ need_model_reload = settings_changed and 'kbvqa' in st.session_state and st.session_state['kbvqa'] is not None
134
+
135
+ if need_model_reload:
136
  st.text("Model Settings have changed, please reload the model, this will take no time :)")
137
 
138
+ button_label = "Reload Model" if need_model_reload else "Load Model"
139
 
140
  if method == "Fine-Tuned Model":
141
  if 'kbvqa' not in st.session_state:
 
168
  image_qa_app(st.session_state['kbvqa'])
169
 
170
  else:
171
+ st.write('Model is not ready yet, will be updated later.')
172
 
173
  # Display model settings
174
  if 'kbvqa' in st.session_state and st.session_state['kbvqa'] is not None: