Janne Mäyrä commited on
Commit
c2607f2
·
unverified ·
1 Parent(s): f695757

edit model inits

Browse files
Files changed (1) hide show
  1. app.py +10 -14
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
- model = YOLO(hp_model)
23
- model.to(device='cpu')
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
- model = YOLO(spk_model)
29
- model.to(device='cpu')
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
- model = YOLO(both_model)
36
- model.to(device='cpu')
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'),