llmx commited on
Commit
25589b8
·
1 Parent(s): 10de22c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -22,12 +22,16 @@ from huggingface_hub import hf_hub_download
22
 
23
 
24
  def load_model(model_name):
25
- model_path = hf_hub_download(repo_id=f"Yolov7/{model_name}", filename=f"{model_name}.pt")
 
 
 
26
 
27
  return model_path
28
 
29
 
30
  model_names = [
 
31
  "yolov7",
32
  "yolov7-e6e",
33
  "yolov7-e6",
@@ -194,4 +198,4 @@ def detect(img,model):
194
  return Image.fromarray(im0[:,:,::-1])
195
 
196
 
197
- gr.Interface(detect,[gr.Image(type="pil"),gr.Dropdown(choices=model_names)], gr.Image(type="pil"),title="Yolov7",examples=[["horses.jpeg", "yolov7"]],description="demo for <a href='https://github.com/WongKinYiu/yolov7' style='text-decoration: underline' target='_blank'>WongKinYiu/yolov7</a> Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors").launch()
 
22
 
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
 
30
  return model_path
31
 
32
 
33
  model_names = [
34
+ "yolov7-DSSLab",
35
  "yolov7",
36
  "yolov7-e6e",
37
  "yolov7-e6",
 
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()