Commit
Β·
746cfcf
1
Parent(s):
4a6f8c9
fixed be
Browse files- README.md +31 -22
- demo/app.py +2 -2
- demo/space.py +29 -20
- pyproject.toml +1 -1
README.md
CHANGED
|
@@ -46,6 +46,7 @@ Author: Csaba (BladeSzaSza)
|
|
| 46 |
|
| 47 |
import gradio as gr
|
| 48 |
import os
|
|
|
|
| 49 |
from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 50 |
|
| 51 |
# Import agent API if available
|
|
@@ -125,23 +126,23 @@ def create_demo() -> gr.Blocks:
|
|
| 125 |
# ββ Hero banner ββ
|
| 126 |
gr.Markdown(
|
| 127 |
"""
|
| 128 |
-
# π Laban Movement Analysis
|
| 129 |
|
| 130 |
-
Pose estimation β’ AI action recognition
|
| 131 |
"""
|
| 132 |
)
|
| 133 |
with gr.Tabs():
|
| 134 |
# Tab 1: Standard Analysis
|
| 135 |
with gr.Tab("π¬ Standard Analysis"):
|
| 136 |
gr.Markdown("""
|
| 137 |
-
###
|
| 138 |
-
Upload a video file to analyze movement using traditional LMA metrics with pose estimation.
|
| 139 |
""")
|
| 140 |
# ββ Workspace ββ
|
| 141 |
with gr.Row(equal_height=True):
|
| 142 |
# Input column
|
| 143 |
with gr.Column(scale=1, min_width=260):
|
| 144 |
|
|
|
|
| 145 |
video_in = gr.Video(label="Upload Video", sources=["upload"], format="mp4")
|
| 146 |
# URL input option
|
| 147 |
url_input_enh = gr.Textbox(
|
|
@@ -149,15 +150,7 @@ def create_demo() -> gr.Blocks:
|
|
| 149 |
placeholder="YouTube URL, Vimeo URL, or direct video URL",
|
| 150 |
info="Leave file upload empty to use URL"
|
| 151 |
)
|
| 152 |
-
|
| 153 |
-
examples=[
|
| 154 |
-
["examples/balette.mp4"],
|
| 155 |
-
["https://www.youtube.com/shorts/RX9kH2l3L8U"],
|
| 156 |
-
["https://vimeo.com/815392738"]
|
| 157 |
-
],
|
| 158 |
-
inputs=url_input_enh,
|
| 159 |
-
label="Examples"
|
| 160 |
-
)
|
| 161 |
gr.Markdown("**Model Selection**")
|
| 162 |
|
| 163 |
model_sel = gr.Dropdown(
|
|
@@ -175,18 +168,28 @@ def create_demo() -> gr.Blocks:
|
|
| 175 |
label="Advanced Pose Models",
|
| 176 |
info="15 model variants available"
|
| 177 |
)
|
| 178 |
-
|
| 179 |
-
gr.Markdown("**Analysis Options**")
|
| 180 |
|
| 181 |
-
with gr.Accordion("Options", open=False):
|
| 182 |
enable_viz = gr.Radio([("Yes", 1), ("No", 0)], value=1, label="Visualization")
|
| 183 |
include_kp = gr.Radio([("Yes", 1), ("No", 0)], value=0, label="Raw Keypoints")
|
| 184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
|
| 186 |
# Output column
|
| 187 |
with gr.Column(scale=2, min_width=320):
|
| 188 |
-
viz_out = gr.Video(label="Annotated Video")
|
| 189 |
-
with gr.Accordion("Raw JSON", open=
|
| 190 |
json_out = gr.JSON(label="Movement Analysis", elem_classes=["json-output"])
|
| 191 |
|
| 192 |
# Wiring
|
|
@@ -273,13 +276,18 @@ bool
|
|
| 273 |
<td align="left">Whether to include raw keypoints in JSON output</td>
|
| 274 |
</tr>
|
| 275 |
|
| 276 |
-
|
|
|
|
|
|
|
| 277 |
|
| 278 |
```python
|
| 279 |
bool
|
| 280 |
```
|
| 281 |
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
<tr>
|
| 285 |
<td align="left"><code>label</code></td>
|
|
@@ -447,4 +455,5 @@ The code snippet below is accurate in cases where the component is used as both
|
|
| 447 |
value: typing.Dict[str, typing.Any][str, typing.Any]
|
| 448 |
) -> typing.Any:
|
| 449 |
return value
|
| 450 |
-
```
|
|
|
|
|
|
| 46 |
|
| 47 |
import gradio as gr
|
| 48 |
import os
|
| 49 |
+
# from backend.gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 50 |
from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 51 |
|
| 52 |
# Import agent API if available
|
|
|
|
| 126 |
# ββ Hero banner ββ
|
| 127 |
gr.Markdown(
|
| 128 |
"""
|
| 129 |
+
# π Laban Movement Analysis
|
| 130 |
|
| 131 |
+
Pose estimation β’ AI action recognition β’ Movement Analysis
|
| 132 |
"""
|
| 133 |
)
|
| 134 |
with gr.Tabs():
|
| 135 |
# Tab 1: Standard Analysis
|
| 136 |
with gr.Tab("π¬ Standard Analysis"):
|
| 137 |
gr.Markdown("""
|
| 138 |
+
### Upload a video file to analyze movement using traditional LMA metrics with pose estimation.
|
|
|
|
| 139 |
""")
|
| 140 |
# ββ Workspace ββ
|
| 141 |
with gr.Row(equal_height=True):
|
| 142 |
# Input column
|
| 143 |
with gr.Column(scale=1, min_width=260):
|
| 144 |
|
| 145 |
+
analyze_btn_enh = gr.Button("π Analyze Movement", variant="primary", size="lg")
|
| 146 |
video_in = gr.Video(label="Upload Video", sources=["upload"], format="mp4")
|
| 147 |
# URL input option
|
| 148 |
url_input_enh = gr.Textbox(
|
|
|
|
| 150 |
placeholder="YouTube URL, Vimeo URL, or direct video URL",
|
| 151 |
info="Leave file upload empty to use URL"
|
| 152 |
)
|
| 153 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
gr.Markdown("**Model Selection**")
|
| 155 |
|
| 156 |
model_sel = gr.Dropdown(
|
|
|
|
| 168 |
label="Advanced Pose Models",
|
| 169 |
info="15 model variants available"
|
| 170 |
)
|
|
|
|
|
|
|
| 171 |
|
| 172 |
+
with gr.Accordion("Analysis Options", open=False):
|
| 173 |
enable_viz = gr.Radio([("Yes", 1), ("No", 0)], value=1, label="Visualization")
|
| 174 |
include_kp = gr.Radio([("Yes", 1), ("No", 0)], value=0, label="Raw Keypoints")
|
| 175 |
+
|
| 176 |
+
gr.Examples(
|
| 177 |
+
examples=[
|
| 178 |
+
["examples/balette.mp4"],
|
| 179 |
+
["https://www.youtube.com/shorts/RX9kH2l3L8U"],
|
| 180 |
+
["https://vimeo.com/815392738"],
|
| 181 |
+
["https://vimeo.com/548964931"],
|
| 182 |
+
["https://videos.pexels.com/video-files/5319339/5319339-uhd_1440_2560_25fps.mp4"],
|
| 183 |
+
],
|
| 184 |
+
inputs=url_input_enh,
|
| 185 |
+
label="Examples"
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
|
| 189 |
# Output column
|
| 190 |
with gr.Column(scale=2, min_width=320):
|
| 191 |
+
viz_out = gr.Video(label="Annotated Video", scale=1, height=400)
|
| 192 |
+
with gr.Accordion("Raw JSON", open=True):
|
| 193 |
json_out = gr.JSON(label="Movement Analysis", elem_classes=["json-output"])
|
| 194 |
|
| 195 |
# Wiring
|
|
|
|
| 276 |
<td align="left">Whether to include raw keypoints in JSON output</td>
|
| 277 |
</tr>
|
| 278 |
|
| 279 |
+
<tr>
|
| 280 |
+
<td align="left"><code>enable_webrtc</code></td>
|
| 281 |
+
<td align="left" style="width: 25%;">
|
| 282 |
|
| 283 |
```python
|
| 284 |
bool
|
| 285 |
```
|
| 286 |
|
| 287 |
+
</td>
|
| 288 |
+
<td align="left"><code>False</code></td>
|
| 289 |
+
<td align="left">Whether to enable WebRTC real-time analysis</td>
|
| 290 |
+
</tr>
|
| 291 |
|
| 292 |
<tr>
|
| 293 |
<td align="left"><code>label</code></td>
|
|
|
|
| 455 |
value: typing.Dict[str, typing.Any][str, typing.Any]
|
| 456 |
) -> typing.Any:
|
| 457 |
return value
|
| 458 |
+
```
|
| 459 |
+
|
demo/app.py
CHANGED
|
@@ -6,8 +6,8 @@ Author: Csaba (BladeSzaSza)
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
-
|
| 10 |
-
from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 11 |
|
| 12 |
# Import agent API if available
|
| 13 |
# Initialize agent API if available
|
|
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
+
from backend.gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 10 |
+
# from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 11 |
|
| 12 |
# Import agent API if available
|
| 13 |
# Initialize agent API if available
|
demo/space.py
CHANGED
|
@@ -8,7 +8,13 @@ _docs = {'LabanMovementAnalysis': {'description': 'Gradio component for video-ba
|
|
| 8 |
abs_path = os.path.join(os.path.dirname(__file__), "css.css")
|
| 9 |
|
| 10 |
with gr.Blocks(
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
) as demo:
|
| 13 |
gr.Markdown(
|
| 14 |
"""
|
|
@@ -40,6 +46,7 @@ Author: Csaba (BladeSzaSza)
|
|
| 40 |
|
| 41 |
import gradio as gr
|
| 42 |
import os
|
|
|
|
| 43 |
from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 44 |
|
| 45 |
# Import agent API if available
|
|
@@ -119,23 +126,23 @@ def create_demo() -> gr.Blocks:
|
|
| 119 |
# ββ Hero banner ββ
|
| 120 |
gr.Markdown(
|
| 121 |
\"\"\"
|
| 122 |
-
# π Laban Movement Analysis
|
| 123 |
|
| 124 |
-
Pose estimation β’ AI action recognition
|
| 125 |
\"\"\"
|
| 126 |
)
|
| 127 |
with gr.Tabs():
|
| 128 |
# Tab 1: Standard Analysis
|
| 129 |
with gr.Tab("π¬ Standard Analysis"):
|
| 130 |
gr.Markdown(\"\"\"
|
| 131 |
-
###
|
| 132 |
-
Upload a video file to analyze movement using traditional LMA metrics with pose estimation.
|
| 133 |
\"\"\")
|
| 134 |
# ββ Workspace ββ
|
| 135 |
with gr.Row(equal_height=True):
|
| 136 |
# Input column
|
| 137 |
with gr.Column(scale=1, min_width=260):
|
| 138 |
|
|
|
|
| 139 |
video_in = gr.Video(label="Upload Video", sources=["upload"], format="mp4")
|
| 140 |
# URL input option
|
| 141 |
url_input_enh = gr.Textbox(
|
|
@@ -143,15 +150,7 @@ def create_demo() -> gr.Blocks:
|
|
| 143 |
placeholder="YouTube URL, Vimeo URL, or direct video URL",
|
| 144 |
info="Leave file upload empty to use URL"
|
| 145 |
)
|
| 146 |
-
|
| 147 |
-
examples=[
|
| 148 |
-
["examples/balette.mp4"],
|
| 149 |
-
["https://www.youtube.com/shorts/RX9kH2l3L8U"],
|
| 150 |
-
["https://vimeo.com/815392738"]
|
| 151 |
-
],
|
| 152 |
-
inputs=url_input_enh,
|
| 153 |
-
label="Examples"
|
| 154 |
-
)
|
| 155 |
gr.Markdown("**Model Selection**")
|
| 156 |
|
| 157 |
model_sel = gr.Dropdown(
|
|
@@ -169,18 +168,28 @@ def create_demo() -> gr.Blocks:
|
|
| 169 |
label="Advanced Pose Models",
|
| 170 |
info="15 model variants available"
|
| 171 |
)
|
| 172 |
-
|
| 173 |
-
gr.Markdown("**Analysis Options**")
|
| 174 |
|
| 175 |
-
with gr.Accordion("Options", open=False):
|
| 176 |
enable_viz = gr.Radio([("Yes", 1), ("No", 0)], value=1, label="Visualization")
|
| 177 |
include_kp = gr.Radio([("Yes", 1), ("No", 0)], value=0, label="Raw Keypoints")
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
# Output column
|
| 181 |
with gr.Column(scale=2, min_width=320):
|
| 182 |
-
viz_out = gr.Video(label="Annotated Video")
|
| 183 |
-
with gr.Accordion("Raw JSON", open=
|
| 184 |
json_out = gr.JSON(label="Movement Analysis", elem_classes=["json-output"])
|
| 185 |
|
| 186 |
# Wiring
|
|
|
|
| 8 |
abs_path = os.path.join(os.path.dirname(__file__), "css.css")
|
| 9 |
|
| 10 |
with gr.Blocks(
|
| 11 |
+
css=abs_path,
|
| 12 |
+
theme=gr.themes.Default(
|
| 13 |
+
font_mono=[
|
| 14 |
+
gr.themes.GoogleFont("Inconsolata"),
|
| 15 |
+
"monospace",
|
| 16 |
+
],
|
| 17 |
+
),
|
| 18 |
) as demo:
|
| 19 |
gr.Markdown(
|
| 20 |
"""
|
|
|
|
| 46 |
|
| 47 |
import gradio as gr
|
| 48 |
import os
|
| 49 |
+
# from backend.gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 50 |
from gradio_labanmovementanalysis import LabanMovementAnalysis
|
| 51 |
|
| 52 |
# Import agent API if available
|
|
|
|
| 126 |
# ββ Hero banner ββ
|
| 127 |
gr.Markdown(
|
| 128 |
\"\"\"
|
| 129 |
+
# π Laban Movement Analysis
|
| 130 |
|
| 131 |
+
Pose estimation β’ AI action recognition β’ Movement Analysis
|
| 132 |
\"\"\"
|
| 133 |
)
|
| 134 |
with gr.Tabs():
|
| 135 |
# Tab 1: Standard Analysis
|
| 136 |
with gr.Tab("π¬ Standard Analysis"):
|
| 137 |
gr.Markdown(\"\"\"
|
| 138 |
+
### Upload a video file to analyze movement using traditional LMA metrics with pose estimation.
|
|
|
|
| 139 |
\"\"\")
|
| 140 |
# ββ Workspace ββ
|
| 141 |
with gr.Row(equal_height=True):
|
| 142 |
# Input column
|
| 143 |
with gr.Column(scale=1, min_width=260):
|
| 144 |
|
| 145 |
+
analyze_btn_enh = gr.Button("π Analyze Movement", variant="primary", size="lg")
|
| 146 |
video_in = gr.Video(label="Upload Video", sources=["upload"], format="mp4")
|
| 147 |
# URL input option
|
| 148 |
url_input_enh = gr.Textbox(
|
|
|
|
| 150 |
placeholder="YouTube URL, Vimeo URL, or direct video URL",
|
| 151 |
info="Leave file upload empty to use URL"
|
| 152 |
)
|
| 153 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
gr.Markdown("**Model Selection**")
|
| 155 |
|
| 156 |
model_sel = gr.Dropdown(
|
|
|
|
| 168 |
label="Advanced Pose Models",
|
| 169 |
info="15 model variants available"
|
| 170 |
)
|
|
|
|
|
|
|
| 171 |
|
| 172 |
+
with gr.Accordion("Analysis Options", open=False):
|
| 173 |
enable_viz = gr.Radio([("Yes", 1), ("No", 0)], value=1, label="Visualization")
|
| 174 |
include_kp = gr.Radio([("Yes", 1), ("No", 0)], value=0, label="Raw Keypoints")
|
| 175 |
+
|
| 176 |
+
gr.Examples(
|
| 177 |
+
examples=[
|
| 178 |
+
["examples/balette.mp4"],
|
| 179 |
+
["https://www.youtube.com/shorts/RX9kH2l3L8U"],
|
| 180 |
+
["https://vimeo.com/815392738"],
|
| 181 |
+
["https://vimeo.com/548964931"],
|
| 182 |
+
["https://videos.pexels.com/video-files/5319339/5319339-uhd_1440_2560_25fps.mp4"],
|
| 183 |
+
],
|
| 184 |
+
inputs=url_input_enh,
|
| 185 |
+
label="Examples"
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
|
| 189 |
# Output column
|
| 190 |
with gr.Column(scale=2, min_width=320):
|
| 191 |
+
viz_out = gr.Video(label="Annotated Video", scale=1, height=400)
|
| 192 |
+
with gr.Accordion("Raw JSON", open=True):
|
| 193 |
json_out = gr.JSON(label="Movement Analysis", elem_classes=["json-output"])
|
| 194 |
|
| 195 |
# Wiring
|
pyproject.toml
CHANGED
|
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
| 8 |
|
| 9 |
[project]
|
| 10 |
name = "gradio_labanmovementanalysis"
|
| 11 |
-
version = "0.0.
|
| 12 |
description = "A Gradio 5 component for video movement analysis using Laban Movement Analysis (LMA) with MCP support for AI agents"
|
| 13 |
readme = "README.md"
|
| 14 |
license = "apache-2.0"
|
|
|
|
| 8 |
|
| 9 |
[project]
|
| 10 |
name = "gradio_labanmovementanalysis"
|
| 11 |
+
version = "0.0.4"
|
| 12 |
description = "A Gradio 5 component for video movement analysis using Laban Movement Analysis (LMA) with MCP support for AI agents"
|
| 13 |
readme = "README.md"
|
| 14 |
license = "apache-2.0"
|