bpy-nvidia-T4 / app.py
Jan-Hendrik Müller
update
8f2742e
raw
history blame
648 Bytes
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()