Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from cad_generation import create_cad_model
|
| 3 |
+
from simulation import run_simulation
|
| 4 |
+
from toolpath_generation import generate_gcode
|
| 5 |
+
|
| 6 |
+
def complete_workflow(dimensions, tolerances, materials, script_path, model_path):
|
| 7 |
+
# Step 1: Collect Parameters
|
| 8 |
+
params = {"dimensions": dimensions, "tolerances": tolerances, "materials": materials}
|
| 9 |
+
result_cad = create_cad_model(float(dimensions))
|
| 10 |
+
result_sim = run_simulation(script_path.name)
|
| 11 |
+
result_gcode = generate_gcode(model_path.name)
|
| 12 |
+
|
| 13 |
+
return f"""
|
| 14 |
+
Workflow Completed:
|
| 15 |
+
Parameters Collected: {params}
|
| 16 |
+
CAD Result: {result_cad}
|
| 17 |
+
Simulation Result: {result_sim}
|
| 18 |
+
G-Code Generation: {result_gcode}
|
| 19 |
+
"""
|
| 20 |
+
|
| 21 |
+
# Gradio Interface
|
| 22 |
+
interface = gr.Interface(
|
| 23 |
+
complete_workflow,
|
| 24 |
+
inputs=[
|
| 25 |
+
gr.Textbox(label="Dimensions"),
|
| 26 |
+
gr.Textbox(label="Tolerances"),
|
| 27 |
+
gr.Textbox(label="Materials"),
|
| 28 |
+
gr.File(label="Simulation Script"),
|
| 29 |
+
gr.File(label="CAD Model Path"),
|
| 30 |
+
],
|
| 31 |
+
outputs="text",
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
interface.launch()
|