Spaces:
Runtime error
Runtime error
Koni commited on
Commit ·
e50f601
1
Parent(s): a64913f
Test using pip library
Browse files- app.py +13 -3
- requirements.txt +1 -2
app.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import numpy as np
|
| 3 |
import os
|
| 4 |
import spaces
|
| 5 |
-
import
|
| 6 |
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
|
|
@@ -22,8 +21,19 @@ def yolov9_inference(img_path, model_id='YOLOv9-S_X_LOCO-converted.pt', img_size
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
model_path = download_models(model_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
def download_models(model_id):
|
| 29 |
hf_hub_download("KoniHD/LOCO-Detection", filename=f"{model_id}", local_dir=f"./",
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import os
|
| 3 |
import spaces
|
| 4 |
+
import yolov9
|
| 5 |
|
| 6 |
from huggingface_hub import hf_hub_download
|
| 7 |
|
|
|
|
| 21 |
"""
|
| 22 |
|
| 23 |
model_path = download_models(model_id)
|
| 24 |
+
model = yolov9.load(model_path)
|
| 25 |
+
|
| 26 |
+
# Set model parameters
|
| 27 |
+
model.conf = conf_thres
|
| 28 |
+
model.iou = iou_thres
|
| 29 |
+
|
| 30 |
+
# Perform inference
|
| 31 |
+
results = model(img_path, size=img_size)
|
| 32 |
|
| 33 |
+
# Optionally, show detection bounding boxes on image
|
| 34 |
+
output = results.render()
|
| 35 |
+
|
| 36 |
+
return output[0]
|
| 37 |
|
| 38 |
def download_models(model_id):
|
| 39 |
hf_hub_download("KoniHD/LOCO-Detection", filename=f"{model_id}", local_dir=f"./",
|
requirements.txt
CHANGED
|
@@ -2,5 +2,4 @@
|
|
| 2 |
# Usage: pip install -r requirements.txt
|
| 3 |
|
| 4 |
huggingface_hub
|
| 5 |
-
|
| 6 |
-
numpy>=1.18.5
|
|
|
|
| 2 |
# Usage: pip install -r requirements.txt
|
| 3 |
|
| 4 |
huggingface_hub
|
| 5 |
+
yolov9pip==0.0.4
|
|
|