Sa-m commited on
Commit
513587a
1 Parent(s): edb3cf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -37,14 +37,20 @@ def detect(inp):
37
  return hub_model.to(device)
38
 
39
  model = custom(path_or_model='best.pt')
40
-
 
 
 
 
 
 
41
 
42
  inp = gr.inputs.Image(type="filepath", label="Input")
43
  #output=gr.outputs.Image(type="pil", label="Output Image")
44
  output = gr.outputs.Image(type="filepath", label="Output")
45
  #.outputs.Textbox()
46
 
47
- io=gr.Interface(fn=detect, inputs=inp, outputs=output, title='Pot Hole Detection With Custom YOLOv7 ',
48
  #examples=[["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg"]]
49
  )
50
  #,examples=["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg"]
 
37
  return hub_model.to(device)
38
 
39
  model = custom(path_or_model='best.pt')
40
+
41
+ def detect1(inp):
42
+ #g = (size / max(inp.size)) #gain
43
+ #im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
44
+ results = model(inp,size=640) # inference
45
+ results.render() # updates results.imgs with boxes and labels
46
+ return Image.fromarray(results.imgs[0])
47
 
48
  inp = gr.inputs.Image(type="filepath", label="Input")
49
  #output=gr.outputs.Image(type="pil", label="Output Image")
50
  output = gr.outputs.Image(type="filepath", label="Output")
51
  #.outputs.Textbox()
52
 
53
+ io=gr.Interface(fn=detect1, inputs=inp, outputs=output, title='Pot Hole Detection With Custom YOLOv7 ',
54
  #examples=[["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg"]]
55
  )
56
  #,examples=["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg"]