Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,17 +5,20 @@ import PIL.Image as Image
|
|
5 |
from ultralytics import YOLO, YOLOv10
|
6 |
from huggingface_hub import hf_hub_download, HfApi
|
7 |
|
|
|
|
|
8 |
def download_models(model_id):
|
9 |
-
hf_hub_download(
|
10 |
return f"./{model_id}"
|
11 |
|
12 |
-
def get_model_filenames(repo_id
|
13 |
api = HfApi()
|
14 |
files = api.list_repo_files(repo_id)
|
15 |
model_filenames = [file for file in files if file.endswith(file_extension)]
|
16 |
return model_filenames
|
17 |
|
18 |
-
|
|
|
19 |
print("Model filenames:", model_filenames)
|
20 |
|
21 |
box_annotator = sv.BoxAnnotator()
|
@@ -49,18 +52,7 @@ def app():
|
|
49 |
with gr.Row():
|
50 |
with gr.Column():
|
51 |
image = gr.Image(type="pil", label="Image", interactive=True)
|
52 |
-
|
53 |
-
# model_id = gr.Dropdown(
|
54 |
-
# label="Model",
|
55 |
-
# choices=[
|
56 |
-
# "yolov10x.pt",
|
57 |
-
# "yolov10s.pt",
|
58 |
-
# "yolov9e.pt",
|
59 |
-
# "yolov9s.pt",
|
60 |
-
# "yolov8x.pt",
|
61 |
-
# ],
|
62 |
-
# value="yolov10s.pt",
|
63 |
-
# )
|
64 |
model_id = gr.Dropdown(
|
65 |
label="Model",
|
66 |
choices=model_filenames,
|
|
|
5 |
from ultralytics import YOLO, YOLOv10
|
6 |
from huggingface_hub import hf_hub_download, HfApi
|
7 |
|
8 |
+
global repo_id="atalaydenknalbant/asl-models"
|
9 |
+
|
10 |
def download_models(model_id):
|
11 |
+
hf_hub_download(repo_id, filename=f"{model_id}", local_dir=f"./")
|
12 |
return f"./{model_id}"
|
13 |
|
14 |
+
def get_model_filenames(repo_id, file_extension=".pt"):
|
15 |
api = HfApi()
|
16 |
files = api.list_repo_files(repo_id)
|
17 |
model_filenames = [file for file in files if file.endswith(file_extension)]
|
18 |
return model_filenames
|
19 |
|
20 |
+
|
21 |
+
model_filenames = get_model_filenames(repo_id)
|
22 |
print("Model filenames:", model_filenames)
|
23 |
|
24 |
box_annotator = sv.BoxAnnotator()
|
|
|
52 |
with gr.Row():
|
53 |
with gr.Column():
|
54 |
image = gr.Image(type="pil", label="Image", interactive=True)
|
55 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
model_id = gr.Dropdown(
|
57 |
label="Model",
|
58 |
choices=model_filenames,
|