Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,10 +2,21 @@ import json
|
|
2 |
|
3 |
import gradio
|
4 |
import torch
|
|
|
5 |
from gradio import inputs, outputs
|
6 |
from PIL import Image
|
7 |
from torchvision import transforms
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
model = torch.hub.load(
|
10 |
"RF5/danbooru-pretrained",
|
11 |
"resnet50",
|
|
|
2 |
|
3 |
import gradio
|
4 |
import torch
|
5 |
+
import torch.hub
|
6 |
from gradio import inputs, outputs
|
7 |
from PIL import Image
|
8 |
from torchvision import transforms
|
9 |
|
10 |
+
real_load = torch.hub.load_state_dict_from_url
|
11 |
+
|
12 |
+
|
13 |
+
def load_state_dict_from_url(*args, **kwargs):
|
14 |
+
kwargs["map_location"] = "cpu"
|
15 |
+
return real_load(*args, **kwargs)
|
16 |
+
|
17 |
+
|
18 |
+
torch.hub.load_state_dict_from_url = load_state_dict_from_url
|
19 |
+
|
20 |
model = torch.hub.load(
|
21 |
"RF5/danbooru-pretrained",
|
22 |
"resnet50",
|