Update app.py
Browse files
app.py
CHANGED
|
@@ -318,28 +318,64 @@ def process_obj_file(file_obj):
|
|
| 318 |
return error_msg
|
| 319 |
|
| 320 |
# Gradio Interface
|
| 321 |
-
demo = gr.Interface(
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
)
|
| 338 |
|
| 339 |
if __name__ == "__main__":
|
| 340 |
print("="*60, flush=True)
|
| 341 |
print("π Starting OBJ File Analyzer...", flush=True)
|
| 342 |
print("="*60, flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
demo.launch(
|
| 344 |
server_name="0.0.0.0",
|
| 345 |
server_port=7860,
|
|
|
|
| 318 |
return error_msg
|
| 319 |
|
| 320 |
# Gradio Interface
|
| 321 |
+
# demo = gr.Interface(
|
| 322 |
+
# fn=process_obj_file,
|
| 323 |
+
# inputs=gr.File(
|
| 324 |
+
# label="Upload OBJ File",
|
| 325 |
+
# file_types=[".obj"],
|
| 326 |
+
# type="file"
|
| 327 |
+
# ),
|
| 328 |
+
# outputs=gr.Textbox(
|
| 329 |
+
# label="Analysis Results (First 10 Lines)",
|
| 330 |
+
# lines=20,
|
| 331 |
+
# max_lines=30
|
| 332 |
+
# ),
|
| 333 |
+
# title="π· OBJ File Analyzer",
|
| 334 |
+
# description="Upload a 3D OBJ file to see the first 10 lines of raw content and mesh analysis",
|
| 335 |
+
# examples=None,
|
| 336 |
+
# cache_examples=False
|
| 337 |
+
# )
|
| 338 |
|
| 339 |
if __name__ == "__main__":
|
| 340 |
print("="*60, flush=True)
|
| 341 |
print("π Starting OBJ File Analyzer...", flush=True)
|
| 342 |
print("="*60, flush=True)
|
| 343 |
+
load_models()
|
| 344 |
+
|
| 345 |
+
|
| 346 |
+
demo = gr.Interface(
|
| 347 |
+
fn=rignet_inference,
|
| 348 |
+
inputs=[
|
| 349 |
+
gr.File(label="Upload OBJ File", file_types=[".obj"], type="file"),
|
| 350 |
+
gr.Slider(0.02, 0.08, value=0.04, step=0.001, label="Bandwidth", info="Joint clustering density (default: 0.04)"),
|
| 351 |
+
gr.Slider(0.1, 3.0, value=1.0, step=0.1, label="Threshold (Γ10β»β΅)", info="Joint filtering threshold (default: 1.0)")
|
| 352 |
+
],
|
| 353 |
+
outputs=[
|
| 354 |
+
gr.File(label="Download Rig TXT"),
|
| 355 |
+
gr.Textbox(label="Status", lines=5)
|
| 356 |
+
],
|
| 357 |
+
title="π RigNet: Neural Rigging for 3D Characters",
|
| 358 |
+
description="""
|
| 359 |
+
Upload a 3D character mesh (OBJ format) to automatically generate skeletal rig and skinning weights.
|
| 360 |
+
|
| 361 |
+
**Recommended:** OBJ files with 1K-5K vertices work best.
|
| 362 |
+
**Processing time:** 1-3 minutes on CPU depending on mesh complexity.
|
| 363 |
+
""",
|
| 364 |
+
article="""
|
| 365 |
+
### π About the Output
|
| 366 |
+
|
| 367 |
+
The generated `*_rig.txt` file contains:
|
| 368 |
+
- **joints**: 3D positions of skeletal joints
|
| 369 |
+
- **root**: Root joint of the hierarchy
|
| 370 |
+
- **hier**: Parent-child relationships (skeleton hierarchy)
|
| 371 |
+
- **skin**: Skinning weights for each vertex
|
| 372 |
+
|
| 373 |
+
This format can be imported into 3D animation software.
|
| 374 |
+
|
| 375 |
+
**Reference:** [RigNet: Neural Rigging for Articulated Characters (SIGGRAPH 2020)](https://arxiv.org/abs/2005.00559)
|
| 376 |
+
""",
|
| 377 |
+
allow_flagging="never"
|
| 378 |
+
)
|
| 379 |
demo.launch(
|
| 380 |
server_name="0.0.0.0",
|
| 381 |
server_port=7860,
|