ffcm commited on
Commit
d2b6714
1 Parent(s): 35cfa5c

setup device

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -6,7 +6,8 @@ import numpy as np
6
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
7
 
8
  with open('cnn_model_9961_sm.bin', 'rb') as f:
9
- nn = pickle.load(f)
 
10
 
11
  nn.to(device)
12
 
@@ -25,6 +26,8 @@ def predict(input):
25
 
26
  demo = gr.Interface(
27
  fn=predict,
 
 
28
  inputs=[
29
  gr.Sketchpad(
30
  shape=(28, 28),
@@ -34,7 +37,7 @@ demo = gr.Interface(
34
  outputs=[
35
  gr.Label(
36
  num_top_classes=3,
37
- scale=2,
38
  )
39
  ],
40
  live=True,
 
6
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
7
 
8
  with open('cnn_model_9961_sm.bin', 'rb') as f:
9
+ # nn = pickle.load(f)
10
+ nn = torch.load(f, map_location=torch.device('cpu'))
11
 
12
  nn.to(device)
13
 
 
26
 
27
  demo = gr.Interface(
28
  fn=predict,
29
+ title='ConvNet for handwritten digits classification',
30
+ description='Check this out <a href="google.com">Google</a>',
31
  inputs=[
32
  gr.Sketchpad(
33
  shape=(28, 28),
 
37
  outputs=[
38
  gr.Label(
39
  num_top_classes=3,
40
+ scale=3,
41
  )
42
  ],
43
  live=True,