Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
3 |
from huggingface_hub import hf_hub_download
|
|
|
4 |
|
5 |
-
|
6 |
def download_models(model_id):
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
@spaces.GPU
|
11 |
def yolov9_inference(img_path, model_id, image_size, conf_threshold, iou_threshold):
|
|
|
1 |
import gradio as gr
|
2 |
import spaces
|
3 |
from huggingface_hub import hf_hub_download
|
4 |
+
import os
|
5 |
|
6 |
+
# Function to download models from Hugging Face
|
7 |
def download_models(model_id):
|
8 |
+
# Check if the model file exists locally
|
9 |
+
local_model_path = "./gelan-c-seg.pt"
|
10 |
+
if not os.path.exists(local_model_path):
|
11 |
+
# Download the model from Hugging Face if it doesn't exist locally
|
12 |
+
hf_hub_download("merve/yolov9", filename="gelan-c-seg.pt", local_dir="./")
|
13 |
+
return local_model_path
|
14 |
+
|
15 |
|
16 |
@spaces.GPU
|
17 |
def yolov9_inference(img_path, model_id, image_size, conf_threshold, iou_threshold):
|