Skip to main content

gradio-openpose-3d

Static Badge 💻 Component GitHub Code

A powerful, custom interactive 3D character posing component for Gradio apps using gr.HTML and Three.js (r160). It allows users to manipulate a 3D model's bones in real-time, adjust camera angles, apply aspect ratio cropping, and export the resulting pose map directly to the Python backend.

Perfect for AI image generation pipelines (like ControlNet or T2I-Adapter), reference posing, or any Gradio app requiring precise visual spatial conditioning.

Inspired by the Openart OpenPose Editor

Features and Key Characteristics

  • Interactive 3D Viewport: Full OrbitControls implementation (zoom, pan, rotate) and TransformControls for bone manipulation.
  • Client-Side Rendering via ESM: Loads modern Three.js directly via CDN (esm.sh) dynamically. No heavy local Node.js builds required.
  • Built-in Undo/Redo System: Autonomous history tracking for bone transformations (Rotation and Translation) with keyboard shortcuts (Ctrl+Z, Ctrl+Shift+Z).
  • Aspect Ratio Cropping: Visual crop overlay with predefined aspect ratios (1:1, 16:9, 9:16, etc.) to frame the exact pose you need.
  • Direct Python Export: clicking the export icon renders the cropped canvas and sends it directly to Gradio server as a PNG file path.
  • Theme Aware UI: The floating toolbar completely integrates with Gradio's native light/dark mode CSS variables.

Installation

pip install gradio-openpose3d-editor

Usage

import gradio as gr
from gradio_openpose3d_editor import OpenPose3DEditor

def process_pose(image_path: str):
    """
    Receives the PNG file path exported by the 3D editor.
    You can open it with PIL, pass it to ControlNet, etc.
    """
    if not image_path:
        return None
    return image_path

with gr.Blocks() as demo:
    gr.Markdown("# 🧍 3D OpenPose Editor")
    
    with gr.Row():
        # Initialize the 3D Editor
        editor = OpenPose3DEditor(
            #fbx_url="https://huggingface.co/buckets/elismasilva/assets/resolve/base.fbx?download=true",  here optional if you want a custom fbx model.
            height=560
        )
        
        # Output component to display the exported PNG
        preview = gr.Image(label="Exported Pose Map", type="filepath")
    
    # Listen to the 'export' event triggered by the floppy disk icon inside the component
    editor.export(
        fn=process_pose,
        inputs=editor,
        outputs=preview
    )
    
demo.launch()

Component API

Initialization Properties

Property Type Default Description
fbx_url str Default URL Optional URL or relative path to the .fbx character model.
height int 540 Height of the 3D viewport container in pixels.
label str | None None Optional label for the component.
visible bool True Whether the component is visible on the screen.
elem_id str | None None Custom HTML ID for targeting with CSS or JavaScript.
elem_classes list[str] | str | None None Additional CSS classes applied to the component wrapper.

Events

Event Description
.export(fn, inputs, outputs, ...) Triggered when the user clicks the "Floppy Disk" export button in the UI. The component's value is automatically updated to the server-side file path (str) of the rendered PNG image, which is then passed to your Python function.

Acknowledgements / Credits

The default 3D model used in this component is provided under the CC BY 4.0 license:

Metadata

Release files for gradio-openpose3d-editor 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gradio-openpose3d-editor 0.0.3
File Size Uploaded Provenance Actions
gradio_openpose3d_editor-0.0.3.tar.gz 10.4 kB Without provenance Details for gradio_openpose3d_editor-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gradio-openpose3d-editor 0.0.3
File Interpreter ABI Platform Actions
gradio_openpose3d_editor-0.0.3-py3-none-any.whl Python 3 none any Details for gradio_openpose3d_editor-0.0.3-py3-none-any.whl

Total release size: 28.2 kB

Release files / gradio_openpose3d_editor-0.0.3.tar.gz

Download URL gradio_openpose3d_editor-0.0.3.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d8d9f14008b7e7d6581dc9985f42a79d480ab4dc2058897886955d9f85b0e271
BLAKE2b-256 checksum
How to use checksums
8df4d408b707327ec6d8896b7f5648faadec8c833eb2920aeb8d19b9afb890c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / gradio_openpose3d_editor-0.0.3-py3-none-any.whl

Download URL gradio_openpose3d_editor-0.0.3-py3-none-any.whl
Size 17.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b2b757b6c2d5aad0c333aad3fdddfa8bf452ee2bfe6727a19fffcce21cba13a
BLAKE2b-256 checksum
How to use checksums
1fc7d38fdc90d3a160539436055343f12178dcba51e3aad9fa1985684b13f545
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for gradio-openpose3d-editor 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page