ancebuc commited on
Commit
0cb35c3
1 Parent(s): 7213c65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -62,6 +62,21 @@ repo_id = "ancebuc/grapes-segmentation"
62
 
63
  learner = from_pretrained_fastai(repo_id)
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
66
  model = model.cpu()
67
  model.eval()
 
62
 
63
  learner = from_pretrained_fastai(repo_id)
64
 
65
+ aux = learner.model
66
+ aux = aux.cpu()
67
+
68
+ import torchvision.transforms as transforms
69
+ img = PILImage.create(path_images/'train/color_206.jpg')
70
+ transformer=transforms.Compose([transforms.Resize((480,640)),
71
+ transforms.ToTensor(),
72
+ transforms.Normalize(
73
+ [0.485, 0.456, 0.406],
74
+ [0.229, 0.224, 0.225])])
75
+ img=transformer(img).unsqueeze(0)
76
+ img=img.cpu()
77
+
78
+ traced_cell=torch.jit.trace(aux, (img))
79
+
80
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
81
  model = model.cpu()
82
  model.eval()