Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,34 +1,27 @@
|
|
| 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(
|
| 7 |
-
# Step 1:
|
| 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
|
| 14 |
gcode_file = generate_gcode(cad_file)
|
| 15 |
|
| 16 |
-
return simulation_results,
|
| 17 |
|
| 18 |
# Gradio Interface
|
| 19 |
interface = gr.Interface(
|
| 20 |
fn=automate_workflow,
|
| 21 |
inputs=[
|
| 22 |
-
gr.
|
| 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="
|
| 32 |
)
|
| 33 |
|
| 34 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from utils.ansys_utils import run_simulation
|
| 3 |
from utils.cnc_utils import generate_gcode
|
| 4 |
|
| 5 |
+
def automate_workflow(cad_file):
|
| 6 |
+
# Step 1: Run Simulation in ANSYS
|
|
|
|
|
|
|
|
|
|
| 7 |
simulation_results = run_simulation(cad_file)
|
| 8 |
|
| 9 |
+
# Step 2: Generate G-Code
|
| 10 |
gcode_file = generate_gcode(cad_file)
|
| 11 |
|
| 12 |
+
return simulation_results, gcode_file
|
| 13 |
|
| 14 |
# Gradio Interface
|
| 15 |
interface = gr.Interface(
|
| 16 |
fn=automate_workflow,
|
| 17 |
inputs=[
|
| 18 |
+
gr.File(label="Upload CAD File (.step format)")
|
|
|
|
|
|
|
| 19 |
],
|
| 20 |
outputs=[
|
| 21 |
gr.Text(label="Simulation Results"),
|
|
|
|
| 22 |
gr.File(label="Generated G-Code File")
|
| 23 |
],
|
| 24 |
+
title="ANSYS Simulation and G-Code Generation"
|
| 25 |
)
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|