Spaces:
Sleeping
Sleeping
File size: 663 Bytes
7b1de54 af71d27 7b1de54 af71d27 7b1de54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import gradio as gr
from vedo import Sphere, show
def render_3d_scene(radius):
# Create a sphere with the given radius
sphere = Sphere(r=radius)
# Render the sphere to an image
output_image_path = "sphere.png"
show(sphere, offscreen=True).screenshot(output_image_path)
# Return the file path of the rendered image
return output_image_path
# Create a Gradio interface
interface = gr.Interface(
fn=render_3d_scene,
inputs=gr.Slider(0.1, 2.0, value=1.0, step=0.1, label="Sphere Radius"),
outputs=gr.Image(type="filepath", label="3D Sphere") # Changed 'type' to 'filepath'
)
# Launch the app
interface.launch()
|