sanjanatule commited on
Commit
02723e8
·
1 Parent(s): 02330ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -80,7 +80,7 @@ with gr.Blocks() as demo:
80
 
81
 
82
  # main function of the app
83
- def yolo3_inference(input_img,gradcam=True,gradcam_opa=0.5): # function for yolo inference
84
 
85
  # load model
86
  yololit = litmodelclass.LitYolo()
@@ -127,7 +127,7 @@ with gr.Blocks() as demo:
127
  for idx, (box) in enumerate(boxes_scale_i):
128
  bboxes[idx] += box
129
  # nms
130
- nms_boxes = utils.non_max_suppression(bboxes[0], iou_threshold=0.6, threshold=0.5, box_format="midpoint",)
131
  nms_boxes_output.append(nms_boxes)
132
 
133
  # use gradio image annotations
@@ -173,13 +173,15 @@ with gr.Blocks() as demo:
173
  with gr.Row():
174
  gradcam_check = gr.Checkbox(label="Gradcam")
175
  gradcam_opa = gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM")
 
 
176
 
177
  section_btn = gr.Button("Identify Objects")
178
- section_btn.click(yolo3_inference, inputs=[img_input,gradcam_check,gradcam_opa], outputs=[img_output])
179
 
180
  gr.Markdown("## Some Examples")
181
  gr.Examples(examples=examples,
182
- inputs =[img_input,gradcam_check,gradcam_opa],
183
  outputs=img_output,
184
  fn=yolo3_inference, cache_examples=False)
185
 
 
80
 
81
 
82
  # main function of the app
83
+ def yolo3_inference(input_img,gradcam=True,gradcam_opa=0.5,user_iou_threshold=0.6,user_threshold=0.5): # function for yolo inference
84
 
85
  # load model
86
  yololit = litmodelclass.LitYolo()
 
127
  for idx, (box) in enumerate(boxes_scale_i):
128
  bboxes[idx] += box
129
  # nms
130
+ nms_boxes = utils.non_max_suppression(bboxes[0], iou_threshold=user_iou_threshold, threshold=user_threshold, box_format="midpoint",)
131
  nms_boxes_output.append(nms_boxes)
132
 
133
  # use gradio image annotations
 
173
  with gr.Row():
174
  gradcam_check = gr.Checkbox(label="Gradcam")
175
  gradcam_opa = gr.Slider(0, 1, value = 0.5, label="Opacity of GradCAM")
176
+ iou_threshold = gr.Slider(0, 1, value = 0.6, label="IOU Threshold")
177
+ threshold = gr.Slider(0, 1, value = 0.5, label="Threshold")
178
 
179
  section_btn = gr.Button("Identify Objects")
180
+ section_btn.click(yolo3_inference, inputs=[img_input,gradcam_check,gradcam_opa,iou_threshold,threshold], outputs=[img_output])
181
 
182
  gr.Markdown("## Some Examples")
183
  gr.Examples(examples=examples,
184
+ inputs =[img_input,gradcam_check,gradcam_opa,iou_threshold,threshold],
185
  outputs=img_output,
186
  fn=yolo3_inference, cache_examples=False)
187