Update app.py
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def normalized(a, axis=-1, order=2):
|
|
57 |
def predict(image):
|
58 |
model = MLP(768) # CLIP embedding dim is 768 for CLIP ViT L 14
|
59 |
pthpath = "https://huggingface.co/haor/aesthetics/resolve/main/sac%2Blogos%2Bava1-l14-linearMSE.pth"
|
60 |
-
device = "
|
61 |
|
62 |
model.load_state_dict(torch.hub.load_state_dict_from_url(pthpath, map_location=device))
|
63 |
model.to(device).eval()
|
|
|
57 |
def predict(image):
|
58 |
model = MLP(768) # CLIP embedding dim is 768 for CLIP ViT L 14
|
59 |
pthpath = "https://huggingface.co/haor/aesthetics/resolve/main/sac%2Blogos%2Bava1-l14-linearMSE.pth"
|
60 |
+
device = "cpu" if torch.cuda.is_available() else "cpu"
|
61 |
|
62 |
model.load_state_dict(torch.hub.load_state_dict_from_url(pthpath, map_location=device))
|
63 |
model.to(device).eval()
|