mypuppeteerai / app.py
dashdoas's picture
Create app.py
cb430e6 verified
Raw
History Blame
1.05 kB
import gradio as gr
import subprocess
import os
import shutil
def run_rigging(input_model):
# 1. Create a clean work folder
if os.path.exists("temp_input"):
shutil.rmtree("temp_input")
os.makedirs("temp_input", exist_ok=True)
# 2. Save your uploaded file into the input folder
input_path = os.path.join("temp_input", "model.glb")
shutil.copy(input_model.name, input_path)
# 3. Trigger the Seed3D rigging script
# We use subprocess to run the .sh file you dragged into the repo
try:
subprocess.run(["bash", "demo_rigging.sh"], check=True)
# Seed3D usually saves results in a 'results' folder
output_path = "results/rigging/model_rigged.glb"
return output_path
except Exception as e:
return f"Error during rigging: {str(e)}"
# This creates the "API Door" for your AI Studio app
demo = gr.Interface(
fn=run_rigging,
inputs=gr.File(label="Upload Model"),
outputs=gr.File(label="Download Rigged Model"),
api_name="rig"
)
demo.launch()