simulationflow / app.py
karthikmn's picture
Create app.py
b05c3dc verified
import gradio as gr
from cad_generation import create_cad_model
from simulation import run_simulation
from toolpath_generation import generate_gcode
def complete_workflow(dimensions, tolerances, materials, script_path, model_path):
# Step 1: Collect Parameters
params = {"dimensions": dimensions, "tolerances": tolerances, "materials": materials}
result_cad = create_cad_model(float(dimensions))
result_sim = run_simulation(script_path.name)
result_gcode = generate_gcode(model_path.name)
return f"""
Workflow Completed:
Parameters Collected: {params}
CAD Result: {result_cad}
Simulation Result: {result_sim}
G-Code Generation: {result_gcode}
"""
# Gradio Interface
interface = gr.Interface(
complete_workflow,
inputs=[
gr.Textbox(label="Dimensions"),
gr.Textbox(label="Tolerances"),
gr.Textbox(label="Materials"),
gr.File(label="Simulation Script"),
gr.File(label="CAD Model Path"),
],
outputs="text",
)
if __name__ == "__main__":
interface.launch()