atalaydenknalbant commited on
Commit
c030bd6
·
verified ·
1 Parent(s): 7f50dca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import spaces
3
  import supervision as sv
4
  import PIL.Image as Image
5
- from ultralytics import YOLO, YOLOv10
6
  from huggingface_hub import hf_hub_download, HfApi
7
 
8
  global repo_id
@@ -32,10 +32,7 @@ category_dict = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E', 5: 'F', 6: 'G', 7: 'H',
32
  @spaces.GPU
33
  def yolo_inference(image, model_id, conf_threshold, iou_threshold, max_detection):
34
  model_path = download_models(model_id)
35
- if model_id[:7] == 'yolov10':
36
- model = YOLOv10(model_path)
37
- else:
38
- model = YOLO(model_path)
39
  results = model(source=image, imgsz=640, iou=iou_threshold, conf=conf_threshold, verbose=False, max_det=max_detection)[0]
40
  detections = sv.Detections.from_ultralytics(results)
41
 
 
2
  import spaces
3
  import supervision as sv
4
  import PIL.Image as Image
5
+ from ultralytics import YOLO
6
  from huggingface_hub import hf_hub_download, HfApi
7
 
8
  global repo_id
 
32
  @spaces.GPU
33
  def yolo_inference(image, model_id, conf_threshold, iou_threshold, max_detection):
34
  model_path = download_models(model_id)
35
+ model = YOLO(model_path)
 
 
 
36
  results = model(source=image, imgsz=640, iou=iou_threshold, conf=conf_threshold, verbose=False, max_det=max_detection)[0]
37
  detections = sv.Detections.from_ultralytics(results)
38