Zengyf-CVer commited on
Commit
b708d4b
·
1 Parent(s): 3e9e4b2

v05 update

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -48,7 +48,7 @@ ROOT_PATH = sys.path[0] # 根目录
48
  yolov5_path = "ultralytics/yolov5"
49
 
50
  # 本地模型路径
51
- local_model_path = f"{ROOT_PATH}/models"
52
 
53
  # Gradio YOLOv5 Det版本
54
  GYD_VERSION = "Gradio YOLOv5 Det v0.5"
@@ -161,8 +161,7 @@ def model_loading(model_name, device, opt=[]):
161
  torch.hub._validate_not_a_forked_repo = lambda a, b, c: True
162
  model = torch.hub.load(
163
  yolov5_path,
164
- "custom",
165
- path=f"{local_model_path}/{model_name}",
166
  device=device,
167
  force_reload=[True if "refresh_yolov5" in opt else False][0],
168
  _verbose=True,
@@ -661,7 +660,7 @@ def main(args):
661
  inputs_maxnum01 = gr.Number(value=max_detnum, label="最大检测数")
662
  inputs_clsName01 = gr.CheckboxGroup(choices=model_cls_name, value=model_cls_name, type="index", label="类别")
663
  inputs_opt01 = gr.CheckboxGroup(choices=["refresh_yolov5", "label", "pdf", "json", "csv", "excel"],
664
- value=["refresh_yolov5", "label", "pdf"],
665
  type="value",
666
  label="操作")
667
 
 
48
  yolov5_path = "ultralytics/yolov5"
49
 
50
  # 本地模型路径
51
+ # local_model_path = f"{ROOT_PATH}/models"
52
 
53
  # Gradio YOLOv5 Det版本
54
  GYD_VERSION = "Gradio YOLOv5 Det v0.5"
 
161
  torch.hub._validate_not_a_forked_repo = lambda a, b, c: True
162
  model = torch.hub.load(
163
  yolov5_path,
164
+ path=model_name,
 
165
  device=device,
166
  force_reload=[True if "refresh_yolov5" in opt else False][0],
167
  _verbose=True,
 
660
  inputs_maxnum01 = gr.Number(value=max_detnum, label="最大检测数")
661
  inputs_clsName01 = gr.CheckboxGroup(choices=model_cls_name, value=model_cls_name, type="index", label="类别")
662
  inputs_opt01 = gr.CheckboxGroup(choices=["refresh_yolov5", "label", "pdf", "json", "csv", "excel"],
663
+ value=["label", "pdf"],
664
  type="value",
665
  label="操作")
666