Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def process_points(point1, point2, point3):
|
| 4 |
+
# Extract coordinates from input points
|
| 5 |
+
x1, y1, z1 = point1
|
| 6 |
+
x2, y2, z2 = point2
|
| 7 |
+
x3, y3, z3 = point3
|
| 8 |
+
|
| 9 |
+
# Format output string
|
| 10 |
+
output = f"Point 1: ({x1}, {y1}, {z1})\nPoint 2: ({x2}, {y2}, {z2})\nPoint 3: ({x3}, {y3}, {z3})"
|
| 11 |
+
|
| 12 |
+
return output
|
| 13 |
+
|
| 14 |
+
# Define Gradio interface
|
| 15 |
+
demo = gr.Interface(
|
| 16 |
+
fn=process_points,
|
| 17 |
+
inputs=[
|
| 18 |
+
gr.Number(label="Point 1 (x, y, z)"),
|
| 19 |
+
gr.Number(label="Point 1 (x, y, z)"),
|
| 20 |
+
gr.Number(label="Point 1 (x, y, z)"),
|
| 21 |
+
gr.Number(label="Point 2 (x, y, z)"),
|
| 22 |
+
gr.Number(label="Point 2 (x, y, z)"),
|
| 23 |
+
gr.Number(label="Point 2 (x, y, z)"),
|
| 24 |
+
gr.Number(label="Point 3 (x, y, z)"),
|
| 25 |
+
gr.Number(label="Point 3 (x, y, z)"),
|
| 26 |
+
gr.Number(label="Point 3 (x, y, z)"),
|
| 27 |
+
],
|
| 28 |
+
outputs=gr.Textbox(label="Output"),
|
| 29 |
+
title="3D Point Formatter",
|
| 30 |
+
description="Enter three points with three coordinates each (x, y, z).",
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# Launch Gradio app
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
demo.launch()
|