Spaces:
Running
Running
| import gradio as gr | |
| from PIL import Image, ImageDraw | |
| def mock_pose_detect(image): | |
| draw = ImageDraw.Draw(image) | |
| parts = { | |
| "head": (50, 30, 150, 130), | |
| "torso": (60, 140, 140, 240), | |
| "left_arm": (30, 140, 60, 220), | |
| "right_arm": (140, 140, 170, 220), | |
| "left_leg": (60, 240, 90, 340), | |
| "right_leg": (110, 240, 140, 340), | |
| } | |
| for label, (x1, y1, x2, y2) in parts.items(): | |
| draw.rectangle([x1, y1, x2, y2], outline="red", width=2) | |
| draw.text((x1, y1 - 10), label, fill="red") | |
| return image | |
| iface = gr.Interface( | |
| fn=mock_pose_detect, | |
| inputs=gr.Image(type="pil"), | |
| outputs=gr.Image(type="pil"), | |
| title="Anime Pose Detector", | |
| description="Upload an anime character image to detect body parts for rigging templates." | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() |