Ahsen Khaliq
commited on
Commit
·
7a9d89d
1
Parent(s):
0d73637
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
os.system("hub install openpose_body_estimation==1.0.0")
|
3 |
+
import gradio as gr
|
4 |
+
import paddlehub as hub
|
5 |
+
import numpy as np
|
6 |
+
|
7 |
+
model = hub.Module(name='openpose_body_estimation')
|
8 |
+
def inference(image):
|
9 |
+
result = model.predict(image.name)
|
10 |
+
return Image.fromarray(np.uint8(result[0])[:,:,::-1]).convert('RGB')
|
11 |
+
|
12 |
+
title = "UGATIT-selfie2anime"
|
13 |
+
description = "Gradio demo for UGATIT-selfie2anime. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
14 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1907.10830' target='_blank'>U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation</a> | <a href='https://github.com/taki0112/UGATIT' target='_blank'>Github Repo</a></p>"
|
15 |
+
|
16 |
+
iface = gr.Interface(inference, inputs=gr.inputs.Image(type="file"), outputs=gr.outputs.Image(type="pil"),enable_queue=True,title=title,article=article,description=description)
|
17 |
+
iface.launch()
|