Spaces:
Runtime error
Runtime error
luca-martial
commited on
Commit
•
040810d
1
Parent(s):
0ea2448
init
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import tensorflow as tf
|
3 |
+
import tensorflow_hub as hub
|
4 |
+
|
5 |
+
hub_model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')
|
6 |
+
|
7 |
+
def stylize(content_image, style_image):
|
8 |
+
stylized_image = hub_model(tf.constant(content_image), tf.constant(style_image))[0]
|
9 |
+
return tensor_to_image(stylized_image)
|
10 |
+
|
11 |
+
iface = gr.Interface(fn=stylize, inputs=["image", "image"], outputs="image")
|
12 |
+
iface.launch()
|