m7mdal7aj commited on
Commit
5b25ca3
1 Parent(s): da52f83

Update my_model/KBVQA.py

Browse files
Files changed (1) hide show
  1. my_model/KBVQA.py +6 -6
my_model/KBVQA.py CHANGED
@@ -249,11 +249,6 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False, force_reload:
249
  Returns:
250
  KBVQA: An instance of the KBVQA model ready for inference.
251
  """
252
-
253
- free_gpu_resources()
254
- kbvqa = KBVQA()
255
- kbvqa.detection_model = st.session_state.detection_model
256
- # Progress bar for model loading
257
 
258
  if force_reload:
259
  loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
@@ -262,9 +257,14 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False, force_reload:
262
  except:
263
  free_gpu_resources()
264
  pass
265
-
266
  free_gpu_resources()
 
267
  else: loading_message = 'Looading model.. this should take no more than a few minutes!'
 
 
 
 
 
268
 
269
  with st.spinner(loading_message):
270
  if not only_reload_detection_model:
 
249
  Returns:
250
  KBVQA: An instance of the KBVQA model ready for inference.
251
  """
 
 
 
 
 
252
 
253
  if force_reload:
254
  loading_message = 'Force Reloading model.. this should take no more than a few minutes!'
 
257
  except:
258
  free_gpu_resources()
259
  pass
 
260
  free_gpu_resources()
261
+
262
  else: loading_message = 'Looading model.. this should take no more than a few minutes!'
263
+
264
+ free_gpu_resources()
265
+ kbvqa = KBVQA()
266
+ kbvqa.detection_model = st.session_state.detection_model
267
+ # Progress bar for model loading
268
 
269
  with st.spinner(loading_message):
270
  if not only_reload_detection_model: