Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import torch
|
|
5 |
import torch.nn.functional as F
|
6 |
import torchvision.transforms as T
|
7 |
from uniformer import uniformer_small
|
|
|
8 |
|
9 |
import gradio as gr
|
10 |
|
@@ -21,11 +22,6 @@ model.load_state_dict(state_dict['model'])
|
|
21 |
model = model.to(device)
|
22 |
model = model.eval()
|
23 |
|
24 |
-
os.system("wget https://huggingface.co/Andy1621/uniformer/blob/main/imagenet_class_index.json")
|
25 |
-
|
26 |
-
with open("imagenet_class_index.json", "r") as f:
|
27 |
-
imagenet_classnames = json.load(f)
|
28 |
-
|
29 |
# Create an id to label name mapping
|
30 |
imagenet_id_to_classname = {}
|
31 |
for k, v in imagenet_classnames.items():
|
|
|
5 |
import torch.nn.functional as F
|
6 |
import torchvision.transforms as T
|
7 |
from uniformer import uniformer_small
|
8 |
+
from imagenet_class_index import imagenet_classnames
|
9 |
|
10 |
import gradio as gr
|
11 |
|
|
|
22 |
model = model.to(device)
|
23 |
model = model.eval()
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
# Create an id to label name mapping
|
26 |
imagenet_id_to_classname = {}
|
27 |
for k, v in imagenet_classnames.items():
|