Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from utils.cad_utils import generate_cad_model
|
| 3 |
+
from utils.ansys_utils import run_simulation
|
| 4 |
+
from utils.cnc_utils import generate_gcode
|
| 5 |
+
|
| 6 |
+
def automate_workflow(dimensions, material, tolerances):
|
| 7 |
+
# Step 1: Generate CAD Model
|
| 8 |
+
cad_file = generate_cad_model(dimensions)
|
| 9 |
+
|
| 10 |
+
# Step 2: Run Simulation in ANSYS
|
| 11 |
+
simulation_results = run_simulation(cad_file)
|
| 12 |
+
|
| 13 |
+
# Step 3: Generate G-Code
|
| 14 |
+
gcode_file = generate_gcode(cad_file)
|
| 15 |
+
|
| 16 |
+
return simulation_results, cad_file, gcode_file
|
| 17 |
+
|
| 18 |
+
# Gradio Interface
|
| 19 |
+
interface = gr.Interface(
|
| 20 |
+
fn=automate_workflow,
|
| 21 |
+
inputs=[
|
| 22 |
+
gr.Textbox(label="Dimensions (e.g., 100x50x30 mm)"),
|
| 23 |
+
gr.Textbox(label="Material (e.g., Steel)"),
|
| 24 |
+
gr.Textbox(label="Tolerances (e.g., ±0.05 mm)")
|
| 25 |
+
],
|
| 26 |
+
outputs=[
|
| 27 |
+
gr.Text(label="Simulation Results"),
|
| 28 |
+
gr.File(label="Generated CAD File"),
|
| 29 |
+
gr.File(label="Generated G-Code File")
|
| 30 |
+
],
|
| 31 |
+
title="Automation Workflow for Design and Manufacturing"
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
interface.launch()
|