Caroline Mai Chan
commited on
Commit
·
379e978
1
Parent(s):
bf3b2c9
fix indent
Browse files
app.py
CHANGED
@@ -65,11 +65,10 @@ model.load_state_dict(torch.load('model.pth'))
|
|
65 |
model.eval()
|
66 |
|
67 |
def predict(input_img):
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
sepia_filter = np.array(
|
72 |
-
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
73 |
)
|
74 |
sepia_img = input_img.dot(sepia_filter.T)
|
75 |
sepia_img /= sepia_img.max()
|
|
|
65 |
model.eval()
|
66 |
|
67 |
def predict(input_img):
|
68 |
+
input_img = Image.open(input_img)
|
69 |
+
ratio = input_img.size[1] / 256.0
|
70 |
+
input_img = input_img.resize((int(ratio*input_img.size[0]),256), Image.ANTIALIAS)
|
71 |
+
sepia_filter = np.array([[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
|
|
72 |
)
|
73 |
sepia_img = input_img.dot(sepia_filter.T)
|
74 |
sepia_img /= sepia_img.max()
|