Kalpokoch commited on
Commit
9812ade
Β·
1 Parent(s): 2a51f8d

fixes to paths

Browse files
Files changed (1) hide show
  1. inference.py +6 -3
inference.py CHANGED
@@ -163,14 +163,17 @@ def preprocess_image(image_path: str, meta: dict) -> torch.Tensor:
163
 
164
 
165
  # ─── Model Loader (singleton) ──────────────────────────────────────────────────
166
-
 
 
167
  _model_cache = {}
168
 
169
- def load_model(weights_path: str, device: str = "cpu") -> tuple:
170
  if weights_path in _model_cache:
171
  return _model_cache[weights_path]
172
 
173
- meta_path = Path(weights_path).with_suffix(".json")
 
174
  with open(meta_path) as f:
175
  meta = json.load(f)
176
 
 
163
 
164
 
165
  # ─── Model Loader (singleton) ──────────────────────────────────────────────────
166
+ weights_path = 'trainedmodels/Model.pth'
167
+ meta_path = 'trainedmodels/Model.json'
168
+ device = 'cpu'
169
  _model_cache = {}
170
 
171
+ def load_model(weights_path, device, meta_path) -> tuple:
172
  if weights_path in _model_cache:
173
  return _model_cache[weights_path]
174
 
175
+ if meta_path is None:
176
+ meta_path = Path(weights_path).with_suffix(".json")
177
  with open(meta_path) as f:
178
  meta = json.load(f)
179