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