Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ tf.config.threading.set_intra_op_parallelism_threads(8)
|
|
17 |
|
18 |
def load_img(image):
|
19 |
"""Load and preprocess image for style transfer"""
|
20 |
-
max_dim =
|
21 |
# Convert PIL Image to tensor
|
22 |
img = tf.convert_to_tensor(np.array(image))
|
23 |
img = tf.image.convert_image_dtype(img, tf.float32)
|
@@ -129,10 +129,8 @@ def style_transfer_fn(content_image, style_image, progress=gr.Progress(track_tqd
|
|
129 |
style_weight = 1e-2
|
130 |
content_weight = 1e4
|
131 |
total_variation_weight = 30
|
132 |
-
|
133 |
epochs = 10
|
134 |
steps_per_epoch = 100
|
135 |
-
|
136 |
start_time = time.time()
|
137 |
|
138 |
# Training loop
|
@@ -158,12 +156,8 @@ iface = gr.Interface(
|
|
158 |
gr.Image(label="Style Image", type="pil")
|
159 |
],
|
160 |
outputs=gr.Image(label="Stylized Image"),
|
161 |
-
title="Neural Style Transfer",
|
162 |
-
description="Upload a content image and a style image to create a stylized
|
163 |
-
examples=[
|
164 |
-
["examples/content.jpg", "examples/style.jpg"]
|
165 |
-
],
|
166 |
-
cache_examples=True
|
167 |
)
|
168 |
|
169 |
# Launch the interface
|
|
|
17 |
|
18 |
def load_img(image):
|
19 |
"""Load and preprocess image for style transfer"""
|
20 |
+
max_dim = 1024
|
21 |
# Convert PIL Image to tensor
|
22 |
img = tf.convert_to_tensor(np.array(image))
|
23 |
img = tf.image.convert_image_dtype(img, tf.float32)
|
|
|
129 |
style_weight = 1e-2
|
130 |
content_weight = 1e4
|
131 |
total_variation_weight = 30
|
|
|
132 |
epochs = 10
|
133 |
steps_per_epoch = 100
|
|
|
134 |
start_time = time.time()
|
135 |
|
136 |
# Training loop
|
|
|
156 |
gr.Image(label="Style Image", type="pil")
|
157 |
],
|
158 |
outputs=gr.Image(label="Stylized Image"),
|
159 |
+
title="Neural Style Transfer - Ty Chermsirivatana",
|
160 |
+
description="Upload a content image and a style image to create a stylized image in context.",
|
|
|
|
|
|
|
|
|
161 |
)
|
162 |
|
163 |
# Launch the interface
|