ning8429 commited on
Commit
16ac16b
·
verified ·
1 Parent(s): 2bbec35

Update api_server.py

Browse files
Files changed (1) hide show
  1. api_server.py +2 -2
api_server.py CHANGED
@@ -25,8 +25,8 @@ if load_type == 'local':
25
  model_path = f'{MODEL_DIR}/{MODEL_NAME}'
26
  if not os.path.exists(model_path):
27
  raise FileNotFoundError(f"Model file not found at {model_path}")
28
- # 使用 torch 來載入 YOLO 模型
29
- model = torch.load(model_path)
30
  model.eval() # 設定模型為推理模式
31
  elif load_type == 'remote_hub_download':
32
  from huggingface_hub import hf_hub_download
 
25
  model_path = f'{MODEL_DIR}/{MODEL_NAME}'
26
  if not os.path.exists(model_path):
27
  raise FileNotFoundError(f"Model file not found at {model_path}")
28
+
29
+ model = YOLO(model_path)
30
  model.eval() # 設定模型為推理模式
31
  elif load_type == 'remote_hub_download':
32
  from huggingface_hub import hf_hub_download