File size: 648 Bytes
8f2742e
 
4373daa
 
8f2742e
 
 
 
6fa48ff
8f2742e
 
 
 
 
 
 
 
 
 
f10a729
8f2742e
 
 
f10a729
6fa48ff
8f2742e
f10a729
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
27
import bpy
from IPython.display import display, Image
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()