Spaces:
Running
Running
File size: 605 Bytes
5630bd7 2ee0be8 4373daa 2ee0be8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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() |