MohamedRashad commited on
Commit
d560a5c
Β·
1 Parent(s): 5269c48

Update README and app.py for improved usage instructions and output handling

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +17 -20
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ†
4
  colorFrom: purple
5
  colorTo: indigo
6
  sdk: gradio
7
- sdk_version: 5.32.0
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: purple
5
  colorTo: indigo
6
  sdk: gradio
7
+ sdk_version: 5.32.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -168,7 +168,7 @@ class UniRigDemo:
168
  final_file = input_model_dir / f"{file_stem}_rigged.glb"
169
  self.merge_results_python(output_skin_file, input_file, final_file)
170
 
171
- return str(final_file)
172
 
173
  def extract_mesh_python(self, input_file: str, output_dir: str) -> str:
174
  """
@@ -462,25 +462,21 @@ def create_app():
462
  </div>
463
  """)
464
 
465
- # Information Section
466
- gr.HTML("""
467
- <h3>πŸ“š About UniRig</h3>
468
- <p>UniRig is a state-of-the-art framework that automates the complex process of 3D model rigging:</p>
469
- <ul>
470
- <li><strong>Skeleton Generation:</strong> AI predicts optimal bone structures</li>
471
- <li><strong>Skinning Weights:</strong> Automatic vertex-to-bone weight assignment</li>
472
- <li><strong>Universal Support:</strong> Works with humans, animals, and objects</li>
473
- </ul>
474
- <p><strong>Supported formats:</strong> .obj, .fbx, .glb</p>
475
  """)
476
 
477
  with gr.Row(equal_height=True):
478
  with gr.Column(scale=1):
479
- input_3d_model = gr.File(
480
- label="Upload 3D Model",
481
- file_types=[".obj", ".fbx", ".glb"],
482
- type="filepath",
483
- )
484
 
485
  with gr.Row(equal_height=True):
486
  seed = gr.Number(
@@ -492,9 +488,10 @@ def create_app():
492
 
493
  pipeline_btn = gr.Button("🎯 Start Complete Pipeline", variant="primary", size="lg")
494
 
495
- with gr.Column(scale=1):
496
- pipeline_skeleton_out = gr.File(label="Final Rigged Model")
497
-
 
498
  random_btn.click(
499
  fn=lambda: int(torch.randint(0, 100000, (1,)).item()),
500
  outputs=seed
@@ -503,7 +500,7 @@ def create_app():
503
  pipeline_btn.click(
504
  fn=demo_instance.complete_pipeline,
505
  inputs=[input_3d_model, seed],
506
- outputs=[pipeline_skeleton_out]
507
  )
508
 
509
  # Footer
 
168
  final_file = input_model_dir / f"{file_stem}_rigged.glb"
169
  self.merge_results_python(output_skin_file, input_file, final_file)
170
 
171
+ return str(final_file), [str(output_skeleton_file), str(output_skin_file), str(final_file)]
172
 
173
  def extract_mesh_python(self, input_file: str, output_dir: str) -> str:
174
  """
 
462
  </div>
463
  """)
464
 
465
+ # Usage Instructions Section
466
+ gr.Markdown("""
467
+ ## πŸ“‹ How to Use ?
468
+ 1. **Upload your 3D model** - Drop your .obj, .fbx, or .glb file in the upload area
469
+ 2. **Set random seed** (optional) - Use the same seed for reproducible results
470
+ 3. **Click "Start Complete Pipeline"** - The AI will automatically rig your model
471
+ 4. **Download results** - `_skeleton.fbx` is the base model with skeleton, `_skin.fbx` is the base model with armature/skeleton and skinning weights, and `_rigged.*` is the final rigged model ready for use.
472
+
473
+ **Supported File Formats:** .obj, .fbx, .glb
474
+ **Note:** The process may take a few minutes depending on the model complexity and server load.
475
  """)
476
 
477
  with gr.Row(equal_height=True):
478
  with gr.Column(scale=1):
479
+ input_3d_model = gr.Model3D(label="Upload 3D Model")
 
 
 
 
480
 
481
  with gr.Row(equal_height=True):
482
  seed = gr.Number(
 
488
 
489
  pipeline_btn = gr.Button("🎯 Start Complete Pipeline", variant="primary", size="lg")
490
 
491
+ with gr.Column():
492
+ pipeline_skeleton_out = gr.Model3D(label="Final Rigged Model", scale=4)
493
+ files_to_download = gr.Files(label="Download Files", scale=1)
494
+
495
  random_btn.click(
496
  fn=lambda: int(torch.randint(0, 100000, (1,)).item()),
497
  outputs=seed
 
500
  pipeline_btn.click(
501
  fn=demo_instance.complete_pipeline,
502
  inputs=[input_3d_model, seed],
503
+ outputs=[pipeline_skeleton_out, files_to_download]
504
  )
505
 
506
  # Footer