llmx commited on
Commit
c6b16ad
·
1 Parent(s): 4ba7e00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
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
- gr.Interface(detect,[gr.Image(type="pil"),gr.Dropdown(choices=model_names)], gr.Image(type="pil"),title="Yolov7-DSSLab",examples=[["horses.jpeg", "yolov7-DSSLab"]],description="经过额外训练的Yolov7 Demo").launch()
 
 
 
 
 
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()