Spaces:
Running
Running
Update hfapp.py
Browse files
hfapp.py
CHANGED
@@ -31,7 +31,7 @@ def localize_anomalies(input_img, preset="edm2-img64-s-fid", load_from_hub=False
|
|
31 |
input_img = input_img.resize(size=(64, 64), resample=Image.Resampling.LANCZOS)
|
32 |
img = np.array(input_img)
|
33 |
img = torch.from_numpy(img).permute(2, 0, 1).unsqueeze(0)
|
34 |
-
model, modeldir = load_model_from_hub(preset=preset, device=
|
35 |
img_likelihood, score_norms = run_inference(model, img)
|
36 |
nll, pct, ref_nll = compute_gmm_likelihood(
|
37 |
score_norms, model_dir=modeldir
|
|
|
31 |
input_img = input_img.resize(size=(64, 64), resample=Image.Resampling.LANCZOS)
|
32 |
img = np.array(input_img)
|
33 |
img = torch.from_numpy(img).permute(2, 0, 1).unsqueeze(0)
|
34 |
+
model, modeldir = load_model_from_hub(preset=preset, device='cpu')
|
35 |
img_likelihood, score_norms = run_inference(model, img)
|
36 |
nll, pct, ref_nll = compute_gmm_likelihood(
|
37 |
score_norms, model_dir=modeldir
|