File size: 1,319 Bytes
d3cd9d4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import numpy as np
import gradio as gr
from yolo.pose import process_image, process_pose_data
def annotate_image(image):
"""Annotate an image with human pose information.
Args:
image: A PIL image object containing the input image.
Returns:
A PIL image object with annotated human poses.
"""
return process_image(image)
def generate_pose_data(image):
"""Analyze an image and general human pose information.
Args:
image: A PIL image object containing the input image.
Returns:
A dictionary with human pose information.
"""
return process_pose_data(image)
with gr.Blocks() as demo:
gr.Markdown("# Yolo v11 Pose Lab")
with gr.Row():
image_input = gr.Image(type="pil", label="Input Image")
with gr.Row(equal_height=True):
image_output = gr.Image(type="pil", label="Annotated Image")
pose_data = gr.Json(label="Pose Data")
with gr.Row():
annotate_image_button = gr.Button("Annotate Image")
generate_pose_data_button = gr.Button("Generate Pose Data")
annotate_image_button.click(annotate_image, inputs=image_input, outputs=image_output)
generate_pose_data_button.click(generate_pose_data, inputs=image_input, outputs=pose_data)
demo.launch(mcp_server=True) |