SatwikKambham commited on
Commit
4818da1
·
1 Parent(s): f49df83

Added example images

Browse files
Examples/2015_01415.jpg ADDED
Examples/2015_03070.jpg ADDED
Examples/2015_03661.jpg ADDED
Examples/2015_06033.jpg ADDED
app.py CHANGED
@@ -51,7 +51,8 @@ class ObjectDetection:
51
  self.model.load_state_dict(model_ckpt)
52
  self.model.eval()
53
 
54
- def predict(self, img, score_threshold, iou_threshold):
 
55
  img_w, img_h = img.size
56
  inp = self.test_transform(image=np.array(img.convert("RGB")))["image"]
57
  out = self.model(inp.unsqueeze(0))
@@ -138,25 +139,15 @@ detector = ObjectDetection(ckpt_path=model_path)
138
  iface = gr.Interface(
139
  fn=detector.predict,
140
  inputs=[
141
- gr.Image(type="pil", label="Input"),
142
- gr.Slider(
143
- minimum=0,
144
- maximum=1,
145
- step=0.05,
146
- value=0.05,
147
- label="Score Threshold",
148
- ),
149
- gr.Slider(
150
- minimum=0,
151
- maximum=1,
152
- step=0.05,
153
- value=0.1,
154
- label="IoU Threshold",
155
  ),
156
  ],
157
  outputs=gr.AnnotatedImage(
158
- height=600,
159
- width=800,
160
  ),
 
161
  )
162
  iface.launch()
 
51
  self.model.load_state_dict(model_ckpt)
52
  self.model.eval()
53
 
54
+ def predict(self, img):
55
+ score_threshold, iou_threshold = 0.05, 0.1
56
  img_w, img_h = img.size
57
  inp = self.test_transform(image=np.array(img.convert("RGB")))["image"]
58
  out = self.model(inp.unsqueeze(0))
 
139
  iface = gr.Interface(
140
  fn=detector.predict,
141
  inputs=[
142
+ gr.Image(
143
+ type="pil",
144
+ label="Input",
145
+ height=400,
 
 
 
 
 
 
 
 
 
 
146
  ),
147
  ],
148
  outputs=gr.AnnotatedImage(
149
+ height=400,
 
150
  ),
151
+ examples="Examples",
152
  )
153
  iface.launch()