Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
fa404c3
1
Parent(s):
e84166a
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
os.system("hub run stylepro_artistic --选项 选项值")
|
3 |
+
import gradio as gr
|
4 |
+
import paddlehub as hub
|
5 |
+
import numpy as np
|
6 |
+
from PIL import Image
|
7 |
+
import cv2
|
8 |
+
|
9 |
+
stylepro_artistic = hub.Module(name="stylepro_artistic")
|
10 |
+
|
11 |
+
def inference(content,style):
|
12 |
+
result = stylepro_artistic.style_transfer(
|
13 |
+
images=[{
|
14 |
+
'content': cv2.imread(content.name),
|
15 |
+
'styles': [cv2.imread(style.name)]
|
16 |
+
}])
|
17 |
+
return Image.fromarray(np.uint8(result[0]['data'])[:,:,::-1]).convert('RGB')
|
18 |
+
|
19 |
+
title = "OpenPose"
|
20 |
+
description = "Gradio demo for OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
21 |
+
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/1812.08008' target='_blank'>OpenPose: Realtime Multi-Person 2D Pose Estimation using Part Affinity Fields</a> | <a href='https://github.com/CMU-Perceptual-Computing-Lab/openpose' target='_blank'>Github Repo</a></p>"
|
22 |
+
examples=[['people.jpeg']]
|
23 |
+
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,examples=examples)
|
24 |
+
iface.launch()
|