Ahsen Khaliq
Create app.py
7980082
raw
history blame
849 Bytes
import os
import cv2
os.system("hub install UGATIT_100w==1.0.0")
import gradio as gr
import paddlehub as hub
model = hub.Module(name='UGATIT_100w', use_gpu=False)
def inference(image):
model.predict(image.name)
result = model.style_transfer(images=[cv2.imread(image.name)])
return result
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=[['lunch.jpeg']]
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="numpy"),examples=examples,enable_queue=True,title=title,article=article,description=description)
iface.launch()