File size: 1,015 Bytes
7980082
 
 
 
 
37b7f6b
f6d5d0f
7980082
 
 
 
e64f4d8
 
37b7f6b
 
f6932a8
7980082
 
 
 
851d7e1
f6d5d0f
7980082
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import cv2
os.system("hub install UGATIT_100w==1.0.0")
import gradio as gr
import paddlehub as hub
import numpy as np
from PIL import Image

model = hub.Module(name='UGATIT_100w', use_gpu=False)

def inference(image):
    #result = model.style_transfer(images=[cv2.imread(image.name)])
    result = model.style_transfer(paths=[image.name])
    print(type(result[0]))
    print(result[0])
    return Image.fromarray(np.uint8(result[0])).convert('RGB')[:,:,::-1]
    
title = "UGATIT-selfie2anime"
description = "Gradio demo for DeOldify. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
article = "<p style='text-align: center'><a href='https://github.com/jantic/DeOldify' target='_blank'>Github Repo</a></p>"
examples=[['pearl.png']]
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="pil"),examples=examples,enable_queue=True,title=title,article=article,description=description)
iface.launch()