Spaces:
Sleeping
Sleeping
| 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() | |