openpose / app.py
Ahsen Khaliq
Update app.py
53f268c
import os
os.system("hub install openpose_body_estimation==1.0.0")
import gradio as gr
import paddlehub as hub
import numpy as np
from PIL import Image
model = hub.Module(name='openpose_body_estimation')
def inference(image):
result = model.predict(image.name)
return Image.fromarray(np.uint8(result['data'])[:,:,::-1]).convert('RGB')
title = "OpenPose"
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."
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>"
examples=[['people.jpeg']]
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)
iface.launch()