a10 commited on
Commit
cbfb8f3
1 Parent(s): 122a5f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -1,7 +1,30 @@
1
- import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #2022aug31
2
+ #import gradio as gr
3
 
4
+ #def greet(name):
5
+ # return "Hello " + name + "!!"
6
 
7
+ #iface = gr.Interface(fn=greet, inputs="text", outputs="text")
8
+ #iface.launch()
9
+
10
+ import torch
11
+ from torch import nn
12
+
13
+ model = nn.Sequential(
14
+ nn.Conv2d(1, 32, 3, padding='same'),
15
+ nn.ReLU(),
16
+ nn.MaxPool2d(2),
17
+ nn.Conv2d(32, 64, 3, padding='same'),
18
+ nn.ReLU(),
19
+ nn.MaxPool2d(2),
20
+ nn.Conv2d(64, 128, 3, padding='same'),
21
+ nn.ReLU(),
22
+ nn.MaxPool2d(2),
23
+ nn.Flatten(),
24
+ nn.Linear(1152, 256),
25
+ nn.ReLU(),
26
+ nn.Linear(256, len(LABELS)),
27
+ )
28
+ state_dict = torch.load('pytorch_model.bin', map_location='cpu')
29
+ model.load_state_dict(state_dict, strict=False)
30
+ model.eval()