gradio-openpose3d-editor 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gradio_openpose3d_editor-0.0.1/.gitignore +13 -0
- gradio_openpose3d_editor-0.0.1/MANIFEST.in +1 -0
- gradio_openpose3d_editor-0.0.1/NOTICE +13 -0
- gradio_openpose3d_editor-0.0.1/PKG-INFO +114 -0
- gradio_openpose3d_editor-0.0.1/README.md +88 -0
- gradio_openpose3d_editor-0.0.1/pyproject.toml +46 -0
- gradio_openpose3d_editor-0.0.1/src/gradio_openpose3d_editor/__init__.py +3 -0
- gradio_openpose3d_editor-0.0.1/src/gradio_openpose3d_editor/gradio_openpose3d_editor.py +610 -0
- gradio_openpose3d_editor-0.0.1/src/gradio_openpose3d_editor/gradio_openpose3d_editor.pyi +616 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include NOTICE
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
========================================================================
|
|
2
|
+
THIRD-PARTY ASSETS AND LICENSES
|
|
3
|
+
========================================================================
|
|
4
|
+
|
|
5
|
+
This project includes the following third-party asset:
|
|
6
|
+
|
|
7
|
+
Asset: Base Mesh T Pose FBX
|
|
8
|
+
Author: nuffylabz
|
|
9
|
+
Source: https://skfb.ly/owXpQ
|
|
10
|
+
License: Creative Commons Attribution 4.0 International (CC BY 4.0)
|
|
11
|
+
License URL: http://creativecommons.org/licenses/by/4.0/
|
|
12
|
+
|
|
13
|
+
"Base Mesh T Pose FBX" (https://skfb.ly/owXpQ) by nuffylabz is licensed under Creative Commons Attribution (http://creativecommons.org/licenses/by/4.0/).
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gradio_openpose3d_editor
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Openpose 3D editor component for Gradio
|
|
5
|
+
Author-email: Eliseu Silva <elismasilva@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: NOTICE
|
|
8
|
+
Keywords: gradio-custom-component
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: gradio<7.0,>=6.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: build; extra == 'dev'
|
|
24
|
+
Requires-Dist: twine; extra == 'dev'
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# `gradio-openpose-3d`
|
|
28
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.1.0%20-%20blue">
|
|
29
|
+
<a href="https://huggingface.co/spaces/elismasilva/gradio_openpose3d_editor"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Demo-blue"></a>
|
|
30
|
+
<span>💻 <a href='https://github.com/DEVAIEXP/gradio_component_openpose3d_editor'>Component GitHub Code</a></span>
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
Perfect for AI image generation pipelines (like ControlNet or T2I-Adapter), reference posing, or any Gradio app requiring precise visual spatial conditioning.
|
|
35
|
+
|
|
36
|
+
Inspired by the Openart OpenPose Editor
|
|
37
|
+
|
|
38
|
+
## Features and Key Characteristics
|
|
39
|
+
|
|
40
|
+
- **Interactive 3D Viewport:** Full OrbitControls implementation (zoom, pan, rotate) and TransformControls for bone manipulation.
|
|
41
|
+
- **Client-Side Rendering via ESM:** Loads modern Three.js directly via CDN (`esm.sh`) dynamically. No heavy local Node.js builds required.
|
|
42
|
+
- **Built-in Undo/Redo System:** Autonomous history tracking for bone transformations (Rotation and Translation) with keyboard shortcuts (`Ctrl+Z`, `Ctrl+Shift+Z`).
|
|
43
|
+
- **Aspect Ratio Cropping:** Visual crop overlay with predefined aspect ratios (1:1, 16:9, 9:16, etc.) to frame the exact pose you need.
|
|
44
|
+
- **Direct Python Export:** clicking the export icon renders the cropped canvas and sends it directly to Gradio server as a PNG file path.
|
|
45
|
+
- **Theme Aware UI:** The floating toolbar completely integrates with Gradio's native light/dark mode CSS variables.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install gradio-openpose3d-editor
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```py
|
|
56
|
+
import gradio as gr
|
|
57
|
+
from gradio_openpose3d_editor import OpenPose3DEditor
|
|
58
|
+
|
|
59
|
+
def process_pose(image_path: str):
|
|
60
|
+
"""
|
|
61
|
+
Receives the PNG file path exported by the 3D editor.
|
|
62
|
+
You can open it with PIL, pass it to ControlNet, etc.
|
|
63
|
+
"""
|
|
64
|
+
if not image_path:
|
|
65
|
+
return None
|
|
66
|
+
return image_path
|
|
67
|
+
|
|
68
|
+
with gr.Blocks() as demo:
|
|
69
|
+
gr.Markdown("# 🧍 3D OpenPose Editor")
|
|
70
|
+
|
|
71
|
+
with gr.Row():
|
|
72
|
+
# Initialize the 3D Editor
|
|
73
|
+
editor = OpenPose3DEditor(
|
|
74
|
+
#fbx_url="https://huggingface.co/buckets/elismasilva/assets/resolve/base.fbx?download=true", here optional if you want a custom fbx model.
|
|
75
|
+
height=560
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Output component to display the exported PNG
|
|
79
|
+
preview = gr.Image(label="Exported Pose Map", type="filepath")
|
|
80
|
+
|
|
81
|
+
# Listen to the 'export' event triggered by the floppy disk icon inside the component
|
|
82
|
+
editor.export(
|
|
83
|
+
fn=process_pose,
|
|
84
|
+
inputs=editor,
|
|
85
|
+
outputs=preview
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
demo.launch()
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Component API
|
|
92
|
+
|
|
93
|
+
### Initialization Properties
|
|
94
|
+
|
|
95
|
+
| Property | Type | Default | Description |
|
|
96
|
+
| :--- | :--- | :--- | :--- |
|
|
97
|
+
| `fbx_url` | `str` | *Default URL* | Optional URL or relative path to the `.fbx` character model. |
|
|
98
|
+
| `height` | `int` | `540` | Height of the 3D viewport container in pixels. |
|
|
99
|
+
| `label` | `str \| None` | `None` | Optional label for the component. |
|
|
100
|
+
| `visible` | `bool` | `True` | Whether the component is visible on the screen. |
|
|
101
|
+
| `elem_id` | `str \| None` | `None` | Custom HTML ID for targeting with CSS or JavaScript. |
|
|
102
|
+
| `elem_classes` | `list[str] \| str \| None` | `None` | Additional CSS classes applied to the component wrapper. |
|
|
103
|
+
|
|
104
|
+
### Events
|
|
105
|
+
|
|
106
|
+
| Event | Description |
|
|
107
|
+
| :--- | :--- |
|
|
108
|
+
| `.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. |
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
## Acknowledgements / Credits
|
|
112
|
+
|
|
113
|
+
The default 3D model used in this component is provided under the CC BY 4.0 license:
|
|
114
|
+
* ["Base Mesh T Pose FBX"](https://skfb.ly/owXpQ) by [nuffylabz](https://sketchfab.com/nuffylabz) is licensed under [Creative Commons Attribution 4.0](http://creativecommons.org/licenses/by/4.0/).
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# `gradio-openpose-3d`
|
|
2
|
+
<img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.1.0%20-%20blue">
|
|
3
|
+
<a href="https://huggingface.co/spaces/elismasilva/gradio_openpose3d_editor"><img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Demo-blue"></a>
|
|
4
|
+
<span>💻 <a href='https://github.com/DEVAIEXP/gradio_component_openpose3d_editor'>Component GitHub Code</a></span>
|
|
5
|
+
|
|
6
|
+
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.
|
|
7
|
+
|
|
8
|
+
Perfect for AI image generation pipelines (like ControlNet or T2I-Adapter), reference posing, or any Gradio app requiring precise visual spatial conditioning.
|
|
9
|
+
|
|
10
|
+
Inspired by the Openart OpenPose Editor
|
|
11
|
+
|
|
12
|
+
## Features and Key Characteristics
|
|
13
|
+
|
|
14
|
+
- **Interactive 3D Viewport:** Full OrbitControls implementation (zoom, pan, rotate) and TransformControls for bone manipulation.
|
|
15
|
+
- **Client-Side Rendering via ESM:** Loads modern Three.js directly via CDN (`esm.sh`) dynamically. No heavy local Node.js builds required.
|
|
16
|
+
- **Built-in Undo/Redo System:** Autonomous history tracking for bone transformations (Rotation and Translation) with keyboard shortcuts (`Ctrl+Z`, `Ctrl+Shift+Z`).
|
|
17
|
+
- **Aspect Ratio Cropping:** Visual crop overlay with predefined aspect ratios (1:1, 16:9, 9:16, etc.) to frame the exact pose you need.
|
|
18
|
+
- **Direct Python Export:** clicking the export icon renders the cropped canvas and sends it directly to Gradio server as a PNG file path.
|
|
19
|
+
- **Theme Aware UI:** The floating toolbar completely integrates with Gradio's native light/dark mode CSS variables.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install gradio-openpose3d-editor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```py
|
|
30
|
+
import gradio as gr
|
|
31
|
+
from gradio_openpose3d_editor import OpenPose3DEditor
|
|
32
|
+
|
|
33
|
+
def process_pose(image_path: str):
|
|
34
|
+
"""
|
|
35
|
+
Receives the PNG file path exported by the 3D editor.
|
|
36
|
+
You can open it with PIL, pass it to ControlNet, etc.
|
|
37
|
+
"""
|
|
38
|
+
if not image_path:
|
|
39
|
+
return None
|
|
40
|
+
return image_path
|
|
41
|
+
|
|
42
|
+
with gr.Blocks() as demo:
|
|
43
|
+
gr.Markdown("# 🧍 3D OpenPose Editor")
|
|
44
|
+
|
|
45
|
+
with gr.Row():
|
|
46
|
+
# Initialize the 3D Editor
|
|
47
|
+
editor = OpenPose3DEditor(
|
|
48
|
+
#fbx_url="https://huggingface.co/buckets/elismasilva/assets/resolve/base.fbx?download=true", here optional if you want a custom fbx model.
|
|
49
|
+
height=560
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Output component to display the exported PNG
|
|
53
|
+
preview = gr.Image(label="Exported Pose Map", type="filepath")
|
|
54
|
+
|
|
55
|
+
# Listen to the 'export' event triggered by the floppy disk icon inside the component
|
|
56
|
+
editor.export(
|
|
57
|
+
fn=process_pose,
|
|
58
|
+
inputs=editor,
|
|
59
|
+
outputs=preview
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
demo.launch()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Component API
|
|
66
|
+
|
|
67
|
+
### Initialization Properties
|
|
68
|
+
|
|
69
|
+
| Property | Type | Default | Description |
|
|
70
|
+
| :--- | :--- | :--- | :--- |
|
|
71
|
+
| `fbx_url` | `str` | *Default URL* | Optional URL or relative path to the `.fbx` character model. |
|
|
72
|
+
| `height` | `int` | `540` | Height of the 3D viewport container in pixels. |
|
|
73
|
+
| `label` | `str \| None` | `None` | Optional label for the component. |
|
|
74
|
+
| `visible` | `bool` | `True` | Whether the component is visible on the screen. |
|
|
75
|
+
| `elem_id` | `str \| None` | `None` | Custom HTML ID for targeting with CSS or JavaScript. |
|
|
76
|
+
| `elem_classes` | `list[str] \| str \| None` | `None` | Additional CSS classes applied to the component wrapper. |
|
|
77
|
+
|
|
78
|
+
### Events
|
|
79
|
+
|
|
80
|
+
| Event | Description |
|
|
81
|
+
| :--- | :--- |
|
|
82
|
+
| `.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. |
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Acknowledgements / Credits
|
|
86
|
+
|
|
87
|
+
The default 3D model used in this component is provided under the CC BY 4.0 license:
|
|
88
|
+
* ["Base Mesh T Pose FBX"](https://skfb.ly/owXpQ) by [nuffylabz](https://sketchfab.com/nuffylabz) is licensed under [Creative Commons Attribution 4.0](http://creativecommons.org/licenses/by/4.0/).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = [
|
|
3
|
+
"hatchling",
|
|
4
|
+
"hatch-requirements-txt",
|
|
5
|
+
"hatch-fancy-pypi-readme>=22.5.0",
|
|
6
|
+
]
|
|
7
|
+
build-backend = "hatchling.build"
|
|
8
|
+
|
|
9
|
+
[project]
|
|
10
|
+
name = "gradio_openpose3d_editor"
|
|
11
|
+
version = "0.0.1"
|
|
12
|
+
description = "Openpose 3D editor component for Gradio"
|
|
13
|
+
readme = "README.md"
|
|
14
|
+
license = "apache-2.0"
|
|
15
|
+
license-files = ["LICENSE", "NOTICE"]
|
|
16
|
+
requires-python = ">=3.10"
|
|
17
|
+
authors = [{ name = "Eliseu Silva", email = "elismasilva@gmail.com" }]
|
|
18
|
+
keywords = ["gradio-custom-component"]
|
|
19
|
+
# Add dependencies here
|
|
20
|
+
dependencies = ["gradio>=6.0,<7.0"]
|
|
21
|
+
classifiers = [
|
|
22
|
+
'Development Status :: 3 - Alpha',
|
|
23
|
+
'Operating System :: OS Independent',
|
|
24
|
+
'Programming Language :: Python :: 3',
|
|
25
|
+
'Programming Language :: Python :: 3 :: Only',
|
|
26
|
+
'Programming Language :: Python :: 3.8',
|
|
27
|
+
'Programming Language :: Python :: 3.9',
|
|
28
|
+
'Programming Language :: Python :: 3.10',
|
|
29
|
+
'Programming Language :: Python :: 3.11',
|
|
30
|
+
'Topic :: Scientific/Engineering',
|
|
31
|
+
'Topic :: Scientific/Engineering :: Artificial Intelligence',
|
|
32
|
+
'Topic :: Scientific/Engineering :: Visualization',
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
# [project.urls]
|
|
36
|
+
repository = "https://github.com/DEVAIEXP/gradio_component_openpose3d_editor"
|
|
37
|
+
space = "https://huggingface.co/spaces/elismasilva/gradio_openpose3d_editor"
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = ["build", "twine"]
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build]
|
|
43
|
+
artifacts = ["*.pyi"]
|
|
44
|
+
|
|
45
|
+
[tool.hatch.build.targets.wheel]
|
|
46
|
+
packages = ["src/gradio_openpose3d_editor"]
|