linhcuem commited on
Commit
aa18569
1 Parent(s): 1316b5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -31,19 +31,19 @@ model = YOLO('linhcuem/cham_diem_yolov8')
31
 
32
  ###################################################
33
  def yolov8_img_inference(
34
- image: gr.inputs.Image = None,
35
- model_path: gr.inputs.Dropdown = None,
36
- image_size: gr.inputs.Slider = 640,
37
- conf_threshold: gr.inputs.Slider = 0.25,
38
- iou_threshold: gr.inputs.Slider = 0.45,
39
  ):
40
  # model = YOLO(model_path)
41
- # model.conf = conf_threshold
42
- # model.iou = iou_threshold
43
- model.overrides['conf'] = conf_threshold
44
- model.overrides['iou'] = iou_threshold
45
- model.overrides['agnostic_nms'] = False
46
- model.overrides['max_det'] = 1000
47
  # image = read_image
48
  results = model.predict(image)
49
  render = render_result(model=model, image=image, result=results[0])
@@ -112,9 +112,11 @@ inputs_image = [
112
  gr.Image(type="pil"),
113
  gr.Dropdown(["linhcuem/linhcuem/cham_diem_yolov8"],
114
  default="linhcuem/cham_diem_yolov8", label="Model"),
115
- gr.Slider(minimum=320, maximum=1280, default=640, step=32, label="Image Size"),
116
- gr.Slider(minimum=0.0, maximum=1.0, default=0.25, step=0.05, label="Confidence Threshold"),
117
- gr.Slider(minimum=0.0, maximum=1.0, default=0.45, step=0.05, label="IOU Threshold"),
 
 
118
  ]
119
 
120
  # outputs_image =gr.outputs.Image(type="filepath", label="Output Image")
 
31
 
32
  ###################################################
33
  def yolov8_img_inference(
34
+ image
35
+ model_path= None,
36
+ image_size= 640,
37
+ conf_threshold= 0.25,
38
+ iou_threshold = 0.45,
39
  ):
40
  # model = YOLO(model_path)
41
+ model.conf = conf_threshold
42
+ model.iou = iou_threshold
43
+ # model.overrides['conf'] = conf_threshold
44
+ # model.overrides['iou'] = iou_threshold
45
+ # model.overrides['agnostic_nms'] = False
46
+ # model.overrides['max_det'] = 1000
47
  # image = read_image
48
  results = model.predict(image)
49
  render = render_result(model=model, image=image, result=results[0])
 
112
  gr.Image(type="pil"),
113
  gr.Dropdown(["linhcuem/linhcuem/cham_diem_yolov8"],
114
  default="linhcuem/cham_diem_yolov8", label="Model"),
115
+ gr.Slider(maximum=1280, step=32, value = 640 label="Image Size"),
116
+ gr.Slider(maximum=1.0 , step=0.05, value = 0.25, label="Confidence Threshold"),
117
+ gr.Slider(maximum=1.0, step=0.05, value = 0.45, label="IOU Threshold"),
118
+
119
+
120
  ]
121
 
122
  # outputs_image =gr.outputs.Image(type="filepath", label="Output Image")