Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,14 +19,14 @@ def style_transfer(content_img,style_img):
|
|
19 |
g_input = paddle.to_tensor(g_input) # numpy -> tensor
|
20 |
h,w = g_input.shape[-2:]
|
21 |
p = max([h,w])
|
22 |
-
g_input = F.interpolate(g_input,scale_factor=(
|
23 |
|
24 |
g_input_s = style_img.astype('float32') / 127.5 - 1 # 归一化
|
25 |
g_input_s = g_input_s[np.newaxis, ...].transpose(0, 3, 1, 2) # NHWC -> NCHW
|
26 |
g_input_s = paddle.to_tensor(g_input_s) # numpy -> tensor
|
27 |
h,w = g_input_s.shape[-2:]
|
28 |
p = max([h,w])
|
29 |
-
g_input_s = F.interpolate(g_input_s,scale_factor=(
|
30 |
|
31 |
i = paddle.to_tensor([1.])
|
32 |
g_output = generator(g_input,g_input_s,i)
|
|
|
19 |
g_input = paddle.to_tensor(g_input) # numpy -> tensor
|
20 |
h,w = g_input.shape[-2:]
|
21 |
p = max([h,w])
|
22 |
+
g_input = F.interpolate(g_input,scale_factor=(512/p))
|
23 |
|
24 |
g_input_s = style_img.astype('float32') / 127.5 - 1 # 归一化
|
25 |
g_input_s = g_input_s[np.newaxis, ...].transpose(0, 3, 1, 2) # NHWC -> NCHW
|
26 |
g_input_s = paddle.to_tensor(g_input_s) # numpy -> tensor
|
27 |
h,w = g_input_s.shape[-2:]
|
28 |
p = max([h,w])
|
29 |
+
g_input_s = F.interpolate(g_input_s,scale_factor=(512/p))
|
30 |
|
31 |
i = paddle.to_tensor([1.])
|
32 |
g_output = generator(g_input,g_input_s,i)
|