Spaces:
Sleeping
Sleeping
Download app.py from sci-blender/bpy-nvidia-T4: direct link, hf CLI and curl.
- Browser
- Download file 605 Bytes
-
https://huggingface.co/spaces/sci-blender/bpy-nvidia-T4/resolve/main/app.py
- Command line
-
hf download hf://spaces/sci-blender/bpy-nvidia-T4/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sci-blender/bpy-nvidia-T4/resolve/main/app.py
605 Bytes
| import bpy | |
| import gradio as gr | |
| # Set up Blender rendering parameters | |
| bpy.context.scene.render.engine = 'BLENDER_WORKBENCH' | |
| bpy.context.scene.render.resolution_x = 500 | |
| bpy.context.scene.render.resolution_y = 200 | |
| # Render the image and save it to a file | |
| path = "test.png" | |
| bpy.ops.render.render() | |
| bpy.data.images["Render Result"].save_render(filepath=path) | |
| # Function to show the rendered image | |
| def show_image(): | |
| return path | |
| # Create a Gradio interface to display the image | |
| demo = gr.Interface( | |
| fn=show_image, | |
| inputs=None, | |
| outputs=gr.Image() | |
| ) | |
| # Launch the Gradio interface | |
| demo.launch() |