Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ from huggingface_hub import hf_hub_download
|
|
23 |
|
24 |
def load_model(model_name):
|
25 |
if model_name == 'yolov7-DSSLab':
|
26 |
-
model_path = hf_hub_download(repo_id=f"llmx/yolov7_det_weapon", filename=f"best_v1.pt")
|
27 |
else:
|
28 |
model_path = hf_hub_download(repo_id=f"Yolov7/{model_name}", filename=f"{model_name}.pt")
|
29 |
|
@@ -197,5 +197,9 @@ def detect(img,model):
|
|
197 |
|
198 |
return Image.fromarray(im0[:,:,::-1])
|
199 |
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
def load_model(model_name):
|
25 |
if model_name == 'yolov7-DSSLab':
|
26 |
+
model_path = hf_hub_download(repo_id=f"llmx/yolov7_det_weapon", filename=f"best_v1.pt", token=os.environ['Huggingface-TOKEN'])
|
27 |
else:
|
28 |
model_path = hf_hub_download(repo_id=f"Yolov7/{model_name}", filename=f"{model_name}.pt")
|
29 |
|
|
|
197 |
|
198 |
return Image.fromarray(im0[:,:,::-1])
|
199 |
|
200 |
+
imgs = os.listdir('./Inference/examples/')
|
201 |
+
examples = []
|
202 |
+
for img in imgs:
|
203 |
+
examples.append([f"./Inference/examples/{img}","yolov7-DSSLab"])
|
204 |
+
|
205 |
+
gr.Interface(detect,[gr.Image(type="pil"),gr.Dropdown(choices=model_names)], gr.Image(type="pil"),title="Yolov7-DSSLab",examples=examples,description="在yolov7基础上经过额外训练的Demo").launch()
|