danielcd99 commited on
Commit
5b6c6f6
·
1 Parent(s): e7f55d6

Changed for cpu(1)

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,6 +4,7 @@ from torch import nn
4
 
5
  labels = ['Zero','Um','Dois','Três','Quatro','Cinco','Seis','Sete','Oito', 'Nove']
6
 
 
7
  if torch.cuda.is_available():
8
  device = torch.device("cuda:0")
9
  print("GPU")
@@ -12,7 +13,7 @@ else:
12
  print("CPU")
13
 
14
 
15
- # NEURAL NETWORK
16
  class LeNet(nn.Module):
17
  def __init__(self):
18
  super(LeNet, self).__init__()
@@ -37,7 +38,7 @@ class LeNet(nn.Module):
37
 
38
  return self.linear(x)
39
 
40
- # LOADING MODEL
41
  model = LeNet().to(device)
42
  model.load_state_dict(torch.load("model_mnist.pth", map_location=torch.device('cpu')))
43
 
 
4
 
5
  labels = ['Zero','Um','Dois','Três','Quatro','Cinco','Seis','Sete','Oito', 'Nove']
6
 
7
+ # Locate device
8
  if torch.cuda.is_available():
9
  device = torch.device("cuda:0")
10
  print("GPU")
 
13
  print("CPU")
14
 
15
 
16
+ # Neural Network
17
  class LeNet(nn.Module):
18
  def __init__(self):
19
  super(LeNet, self).__init__()
 
38
 
39
  return self.linear(x)
40
 
41
+ # Loading model
42
  model = LeNet().to(device)
43
  model.load_state_dict(torch.load("model_mnist.pth", map_location=torch.device('cpu')))
44