Spaces:
Sleeping
Sleeping
Update my_model/KBVQA.py
Browse files- my_model/KBVQA.py +6 -6
my_model/KBVQA.py
CHANGED
@@ -268,27 +268,27 @@ def prepare_kbvqa_model(only_reload_detection_model: bool = False) -> KBVQA:
|
|
268 |
kbvqa = KBVQA()
|
269 |
kbvqa.detection_model = st.session_state.detection_model
|
270 |
# Progress bar for model loading
|
271 |
-
with
|
272 |
|
273 |
if not only_reload_detection_model:
|
274 |
-
|
275 |
-
progress_bar =
|
276 |
kbvqa.load_detector(kbvqa.detection_model)
|
277 |
progress_bar.progress(33)
|
278 |
kbvqa.load_caption_model()
|
279 |
free_gpu_resources()
|
280 |
progress_bar.progress(75)
|
281 |
-
|
282 |
kbvqa.load_fine_tuned_model()
|
283 |
free_gpu_resources()
|
284 |
progress_bar.progress(100)
|
285 |
else:
|
286 |
-
progress_bar =
|
287 |
kbvqa.load_detector(kbvqa.detection_model)
|
288 |
progress_bar.progress(100)
|
289 |
|
290 |
if kbvqa.all_models_loaded:
|
291 |
-
|
292 |
kbvqa.kbvqa_model.eval()
|
293 |
free_gpu_resources()
|
294 |
return kbvqa
|
|
|
268 |
kbvqa = KBVQA()
|
269 |
kbvqa.detection_model = st.session_state.detection_model
|
270 |
# Progress bar for model loading
|
271 |
+
with kbvqa.col1.spinner('Loading model...'):
|
272 |
|
273 |
if not only_reload_detection_model:
|
274 |
+
kbvqa.col1.text('this should take no more than a few minutes!')
|
275 |
+
progress_bar = kbvqa.col1.progress(0)
|
276 |
kbvqa.load_detector(kbvqa.detection_model)
|
277 |
progress_bar.progress(33)
|
278 |
kbvqa.load_caption_model()
|
279 |
free_gpu_resources()
|
280 |
progress_bar.progress(75)
|
281 |
+
kbvqa.col1.text('Almost there :)')
|
282 |
kbvqa.load_fine_tuned_model()
|
283 |
free_gpu_resources()
|
284 |
progress_bar.progress(100)
|
285 |
else:
|
286 |
+
progress_bar = kbvqa.col1.progress(0)
|
287 |
kbvqa.load_detector(kbvqa.detection_model)
|
288 |
progress_bar.progress(100)
|
289 |
|
290 |
if kbvqa.all_models_loaded:
|
291 |
+
kbvqa.col1.success('Model loaded successfully and ready for inferecne!')
|
292 |
kbvqa.kbvqa_model.eval()
|
293 |
free_gpu_resources()
|
294 |
return kbvqa
|