tejani commited on
Commit
7a89e4a
·
verified ·
1 Parent(s): 32400ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -14,7 +14,8 @@ OUTPUT_DIR.mkdir(exist_ok=True)
14
 
15
  # Load pre-trained models
16
  def load_model(model_path, use_cpu=False):
17
- model = torch.load(model_path, map_location="cpu" if use_cpu else None)
 
18
  if not use_cpu and torch.cuda.is_available():
19
  model = model.cuda()
20
  model.eval()
 
14
 
15
  # Load pre-trained models
16
  def load_model(model_path, use_cpu=False):
17
+ # Explicitly set weights_only=False to load the full model object
18
+ model = torch.load(model_path, map_location="cpu" if use_cpu else None, weights_only=False)
19
  if not use_cpu and torch.cuda.is_available():
20
  model = model.cuda()
21
  model.eval()