Spaces:
Runtime error
Runtime error
#2022aug31 | |
#import gradio as gr | |
#def greet(name): | |
# return "Hello " + name + "!!" | |
#iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
#iface.launch() | |
import torch | |
from torch import nn | |
model = nn.Sequential( | |
nn.Conv2d(1, 32, 3, padding='same'), | |
nn.ReLU(), | |
nn.MaxPool2d(2), | |
nn.Conv2d(32, 64, 3, padding='same'), | |
nn.ReLU(), | |
nn.MaxPool2d(2), | |
nn.Conv2d(64, 128, 3, padding='same'), | |
nn.ReLU(), | |
nn.MaxPool2d(2), | |
nn.Flatten(), | |
nn.Linear(1152, 256), | |
nn.ReLU(), | |
nn.Linear(256, len(LABELS)), | |
) | |
state_dict = torch.load('pytorch_model.bin', map_location='cpu') | |
model.load_state_dict(state_dict, strict=False) | |
model.eval() | |