raihanp commited on
Commit
d6ef684
·
verified ·
1 Parent(s): b0f2d06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -4,10 +4,17 @@ import gradio as gr
4
  from torchvision.transforms import Compose, Normalize, ToTensor, Resize, CenterCrop
5
 
6
 
7
- inference = torch.load('fine_tune_resnet.pth')
8
  inference.eval()
9
 
10
  def classifier(image):
 
 
 
 
 
 
 
11
  if torch.cuda.is_available():
12
  inference.cpu()
13
 
 
4
  from torchvision.transforms import Compose, Normalize, ToTensor, Resize, CenterCrop
5
 
6
 
7
+ inference = torch.load('fine_tune_resnet.pth', map_location=torch.device('cpu'))
8
  inference.eval()
9
 
10
  def classifier(image):
11
+ test_transform = Compose([
12
+ Resize(256),
13
+ CenterCrop(224),
14
+ ToTensor(),
15
+ Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
16
+ ])
17
+
18
  if torch.cuda.is_available():
19
  inference.cpu()
20