Spaces:
Runtime error
Runtime error
Commit
•
63ec576
1
Parent(s):
90ba4b1
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import tensorflow as tf
|
3 |
import tensorflow_hub as hub
|
4 |
from PIL import Image
|
|
|
5 |
|
6 |
model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
7 |
|
@@ -10,7 +11,7 @@ def style_transfer(content_img, style_img):
|
|
10 |
style_img = tf.convert_to_tensor(style_img,tf.float32)[tf.newaxis,...] / 255.
|
11 |
|
12 |
generated_img = model(content_img, style_img)[0]
|
13 |
-
return Image.fromarray(np.
|
14 |
|
15 |
|
16 |
title = "Neural Style Transfer"
|
|
|
2 |
import tensorflow as tf
|
3 |
import tensorflow_hub as hub
|
4 |
from PIL import Image
|
5 |
+
import numpy as np
|
6 |
|
7 |
model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
8 |
|
|
|
11 |
style_img = tf.convert_to_tensor(style_img,tf.float32)[tf.newaxis,...] / 255.
|
12 |
|
13 |
generated_img = model(content_img, style_img)[0]
|
14 |
+
return Image.fromarray(np.uint8(generated_img[0]*255))
|
15 |
|
16 |
|
17 |
title = "Neural Style Transfer"
|