mennamostafa55555 commited on
Commit
1cdeb8f
·
1 Parent(s): 7f499fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -28,19 +28,17 @@ annotatormask=sv.MaskAnnotator()
28
 
29
  def yolov8_inference(
30
  image: gr.inputs.Image = None,
31
- model_name: gr.inputs.Dropdown = None,
32
- image_size: gr.inputs.Slider = 640,
33
- conf_threshold: gr.inputs.Slider = 0.25,
34
  iou_threshold: gr.inputs.Slider = 0.45,
35
  ):
36
 
37
-
38
- model = YOLO("https://huggingface.co/spaces/devisionx/Sixth_Demo/blob/main/bestt_weight.pt")
39
-
40
- results = model(image,conf=conf_threshold,iou=iou_threshold ,imgsz=640)[0]
41
  detections = sv.Detections.from_yolov8(results)
42
- annotated_image = annotatorbbox.annotate(scene=image, detections=detections)
43
- annotated_image = annotatormask.annotate(scene=annotated_image, detections=detections)
44
 
45
 
46
 
 
28
 
29
  def yolov8_inference(
30
  image: gr.inputs.Image = None,
31
+ conf_threshold: gr.inputs.Slider = 0.5,
 
 
32
  iou_threshold: gr.inputs.Slider = 0.45,
33
  ):
34
 
35
+ image=image[:, :, ::-1].astype(np.uint8)
36
+ model = YOLO("/content/segment/train/weights/best.pt")
37
+ results = model(image,imgsz=640)[0]
38
+ image=image[:, :, ::-1].astype(np.uint8)
39
  detections = sv.Detections.from_yolov8(results)
40
+ annotated_image = annotatormask.annotate(scene=image, detections=detections)
41
+ annotated_image = annotatorbbox.annotate(scene=annotated_image , detections=detections)
42
 
43
 
44