File size: 622 Bytes
286a8b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os

# Load compressed models from tensorflow_hub
os.environ['TFHUB_MODEL_LOAD_FORMAT'] = 'COMPRESSED'

import matplotlib as mpl

mpl.rcParams['figure.figsize'] = (12, 12)
mpl.rcParams['axes.grid'] = False

import tensorflow_hub as hub

from neural_style_transfer import StyleStealer

import gradio as gr

if __name__ == "__main__":
    hub_model = hub.load('https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2')

    worker = StyleStealer(hub_model)

    demo = gr.Interface(
        fn=worker.steal,
        inputs=["image", "image"],
        outputs=["image"]
    )

    demo.launch(share=True)