paugar commited on
Commit
7988f17
·
verified ·
1 Parent(s): 3d1dccf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -18,17 +18,21 @@ model = model.to(device)
18
 
19
  def load_img (filename):
20
  img = Image.open(filename).convert("RGB")
21
- img_tensor = pil_to_tensor(img)
22
- return img_tensor
23
 
24
  def process_img(image):
25
  y = img.to(device)
26
 
27
  with torch.no_grad():
28
  result = model(y)
29
-
30
- return Image.fromarray(result)
31
 
 
 
 
 
 
 
 
32
  title = "Efficient Hazy Vehicle Detection ✏️[] 🤗"
33
  description = ''' ## [Efficient Hazy Vehicle Detection](https://github.com/cidautai)
34
  [Paula Garrido Mellado](https://github.com/paugar5)
 
18
 
19
  def load_img (filename):
20
  img = Image.open(filename).convert("RGB")
21
+ return img
 
22
 
23
  def process_img(image):
24
  y = img.to(device)
25
 
26
  with torch.no_grad():
27
  result = model(y)
 
 
28
 
29
+ if len(result[0].boxes.boxes)>0:
30
+ vis = plots.plot_detection(img,boxes=result[0].boxes.boxes,
31
+ class_names=class_names, min_score=0.2)
32
+ else:
33
+ vis = img
34
+ return vis
35
+
36
  title = "Efficient Hazy Vehicle Detection ✏️[] 🤗"
37
  description = ''' ## [Efficient Hazy Vehicle Detection](https://github.com/cidautai)
38
  [Paula Garrido Mellado](https://github.com/paugar5)