Spaces:
Runtime error
Runtime error
Download app.py from playerplayerop1/3D_Model_Generatorr: direct link, hf CLI and curl.
- Browser
- Download file 943 Bytes
-
https://huggingface.co/spaces/playerplayerop1/3D_Model_Generatorr/resolve/main/app.py
- Command line
-
hf download hf://spaces/playerplayerop1/3D_Model_Generatorr/app.py
-
curl -L -o app.py https://huggingface.co/spaces/playerplayerop1/3D_Model_Generatorr/resolve/main/app.py
943 Bytes
| import gradio as gr | |
| import subprocess | |
| import os | |
| def blender_islet(python_kodu): | |
| # Temizlik | |
| for f in ["model.glb", "render.png", "exec_script.py"]: | |
| if os.path.exists(f): os.remove(f) | |
| # Kodu yaz | |
| with open("exec_script.py", "w") as f: | |
| f.write(python_kodu) | |
| # Blender'ı çalıştır ve TÜM ÇIKTIYI yakala | |
| process = subprocess.run( | |
| ["blender", "--background", "--python", "exec_script.py"], | |
| capture_output=True, | |
| text=True | |
| ) | |
| # Blender'ın siyah ekranında ne yazdıysa VS Code'a gönder | |
| full_log = process.stdout + "\n" + process.stderr | |
| outputs = [] | |
| if os.path.exists("model.glb"): outputs.append("model.glb") | |
| if os.path.exists("render.png"): outputs.append("render.png") | |
| return full_log, outputs | |
| demo = gr.Interface( | |
| fn=blender_islet, | |
| inputs="text", | |
| outputs=["text", "file"], | |
| api_name="islet" | |
| ) | |
| demo.launch() |