Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import subprocess | |
| import os | |
| import shutil | |
| def process_image(image): | |
| input_path = "input.jpg" | |
| output_dir = "output" | |
| if os.path.exists(output_dir): | |
| shutil.rmtree(output_dir) | |
| image.save(input_path) | |
| result = subprocess.run(["python", "TripoSR/TripoSR/run.py", input_path, "--output-dir", output_dir], capture_output=True, text=True) | |
| print(result.stdout) | |
| print(result.stderr) | |
| output_file = os.path.join(output_dir, "input", "mesh.obj") | |
| if os.path.exists(output_file): | |
| return output_file | |
| else: | |
| return "Processing failed. See logs." | |
| gr.Interface( | |
| fn=process_image, | |
| inputs=gr.Image(type="pil", label="Upload Clothing Image"), | |
| outputs=gr.File(label="Download 3D Model (.obj)"), | |
| title="TripoSR Clothing 2D to 3D Converter" | |
| ).launch() | |