Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,4 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
-
"""app.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colab.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/17w1I1LKrJAebkjqIeNAKHQDirlY8Xxsw
|
8 |
-
"""
|
9 |
|
10 |
import torch
|
11 |
import torch.nn.functional as F
|
@@ -50,7 +43,7 @@ def fit_picture(img):
|
|
50 |
padding_width = (target_width - resize_width) if target_width > resize_width else 0
|
51 |
pad_transform = transforms.Pad((0, 0, padding_width, padding_height), fill=0, padding_mode='constant')
|
52 |
|
53 |
-
|
54 |
torchvision.transforms.Grayscale(num_output_channels = 1),
|
55 |
torchvision.transforms.ToTensor(),
|
56 |
torchvision.transforms.Normalize(0.5,0.5),
|
@@ -58,7 +51,7 @@ def fit_picture(img):
|
|
58 |
pad_transform
|
59 |
])
|
60 |
|
61 |
-
fin_img =
|
62 |
return fin_img
|
63 |
|
64 |
def load_model(filename):
|
|
|
1 |
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
import torch
|
4 |
import torch.nn.functional as F
|
|
|
43 |
padding_width = (target_width - resize_width) if target_width > resize_width else 0
|
44 |
pad_transform = transforms.Pad((0, 0, padding_width, padding_height), fill=0, padding_mode='constant')
|
45 |
|
46 |
+
transformss = torchvision.transforms.Compose([
|
47 |
torchvision.transforms.Grayscale(num_output_channels = 1),
|
48 |
torchvision.transforms.ToTensor(),
|
49 |
torchvision.transforms.Normalize(0.5,0.5),
|
|
|
51 |
pad_transform
|
52 |
])
|
53 |
|
54 |
+
fin_img = transformss(img)
|
55 |
return fin_img
|
56 |
|
57 |
def load_model(filename):
|