Spaces:
Sleeping
Sleeping
Janne Mäyrä
commited on
edit model inits
Browse files
app.py
CHANGED
@@ -18,25 +18,21 @@ def run_models(
|
|
18 |
conf_thr:gr.Slider=0.25
|
19 |
):
|
20 |
|
21 |
-
hp_model = f'{model_paths[model_type]}_hp/best.pt'
|
22 |
-
|
23 |
-
|
24 |
-
hp_result = model(im[:,:,::-1], conf=conf_thr)
|
25 |
hp_im = hp_result[0].plot()
|
26 |
|
27 |
-
spk_model = f'{model_paths[model_type]}_spk/best.pt'
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
spk_result = model(im[:,:,::-1], conf=conf_thr)
|
32 |
spk_im = spk_result[0].plot()
|
33 |
|
34 |
-
both_model = f'{model_paths[model_type]}_both/best.pt'
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
both_result = model(im[:,:,::-1], conf=conf_thr)
|
39 |
both_im = both_result[0].plot()
|
|
|
40 |
return [
|
41 |
(hp_im[:,:,::-1], 'HP'),
|
42 |
(spk_im[:,:,::-1], 'SPK'),
|
|
|
18 |
conf_thr:gr.Slider=0.25
|
19 |
):
|
20 |
|
21 |
+
hp_model = YOLO(f'{model_paths[model_type]}_hp/best.pt')
|
22 |
+
hp_model.to(device='cpu')
|
23 |
+
hp_result = hp_model(im[:,:,::-1], conf=conf_thr)
|
|
|
24 |
hp_im = hp_result[0].plot()
|
25 |
|
26 |
+
spk_model = YOLO(f'{model_paths[model_type]}_spk/best.pt')
|
27 |
+
spk_model.to(device='cpu')
|
28 |
+
spk_result = spk_model(im[:,:,::-1], conf=conf_thr)
|
|
|
|
|
29 |
spk_im = spk_result[0].plot()
|
30 |
|
31 |
+
both_model = YOLO(f'{model_paths[model_type]}_both/best.pt')
|
32 |
+
both_model.to(device='cpu')
|
33 |
+
both_result = both_model(im[:,:,::-1], conf=conf_thr)
|
|
|
|
|
34 |
both_im = both_result[0].plot()
|
35 |
+
|
36 |
return [
|
37 |
(hp_im[:,:,::-1], 'HP'),
|
38 |
(spk_im[:,:,::-1], 'SPK'),
|