lopesdri commited on
Commit
f1fe0df
·
1 Parent(s): 96a8c89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -14,19 +14,20 @@ model.multi_label = False
14
  model.max_det = 1000
15
 
16
 
17
- def detect(img):
18
 
19
 
20
- results = model(img, size=640)
21
 
22
- predictions = results.pred[0]
23
- boxes = predictions[:, :4] # x1, y1, x2, y2
24
- scores = predictions[:, 4]
25
- categories = predictions[:, 5]
26
- annotated_image = np.squeeze(results.render())
 
 
27
 
28
 
29
- img = gr.inputs.Image(shape=(192, 192))
30
 
31
- intf = gr.Interface(fn=detect, inputs=img, outputs='image')
32
  intf.launch(inline=False)
 
14
  model.max_det = 1000
15
 
16
 
17
+ img = gr.inputs.Image(shape=(192, 192))
18
 
19
 
20
+ results = model(img, size=640)
21
 
22
+ predictions = results.pred[0]
23
+ boxes = predictions[:, :4] # x1, y1, x2, y2
24
+ scores = predictions[:, 4]
25
+ categories = predictions[:, 5]
26
+ annotated_image = np.squeeze(results.render())
27
+
28
+ outputs= plt.imshow(annotated_image)
29
 
30
 
 
31
 
32
+ intf = gr.Interface(inputs=img, outputs=outputs)
33
  intf.launch(inline=False)