kadirnar commited on
Commit
cab2267
1 Parent(s): 4a31799

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -2,11 +2,17 @@ import gradio as gr
2
  from ultralytics import YOLOv10
3
  import supervision as sv
4
  import spaces
 
5
 
6
 
 
 
 
 
7
  MODEL_PATH = 'yolov10n.pt'
8
  model = YOLOv10(MODEL_PATH)
9
  box_annotator = sv.BoxAnnotator()
 
10
 
11
  @spaces.GPU(duration=200)
12
  def detect(image):
 
2
  from ultralytics import YOLOv10
3
  import supervision as sv
4
  import spaces
5
+ from huggingface_hub import hf_hub_download
6
 
7
 
8
+ def download_models(model_id):
9
+ hf_hub_download("kadirnar/yolov10", filename=f"{model_id}", local_dir=f"./")
10
+ return f"./{model_id}"
11
+
12
  MODEL_PATH = 'yolov10n.pt'
13
  model = YOLOv10(MODEL_PATH)
14
  box_annotator = sv.BoxAnnotator()
15
+ model_path = download_models(model_id)
16
 
17
  @spaces.GPU(duration=200)
18
  def detect(image):