Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,7 @@ with gr.Blocks() as app:
|
|
| 23 |
outputs=[die_output, visualization_output],
|
| 24 |
)
|
| 25 |
|
| 26 |
-
|
| 27 |
gr.Markdown("### Select Simulation Tool and Enter Parameters for Stress Analysis")
|
| 28 |
force = gr.Number(label="Force (N)", value=10000)
|
| 29 |
die_width = gr.Number(label="Width (m)", value=0.05)
|
|
@@ -38,24 +38,24 @@ with gr.Blocks() as app:
|
|
| 38 |
stress_chart = gr.Plot()
|
| 39 |
stress_button = gr.Button("Analyze Stress")
|
| 40 |
stress_button.click(
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
)
|
| 45 |
|
| 46 |
with gr.Tab("Tool Optimization"):
|
| 47 |
gr.Markdown("### Enter Machining Parameters for Tool Optimization")
|
| 48 |
speed = gr.Number(label="Cutting Speed (m/min)", value=100)
|
| 49 |
feed_rate = gr.Number(label="Feed Rate (mm/rev)", value=0.2)
|
| 50 |
-
|
| 51 |
-
|
| 52 |
optimization_results = gr.JSON(label="Optimization Results")
|
| 53 |
optimize_button = gr.Button("Optimize Tool")
|
| 54 |
optimize_button.click(
|
| 55 |
lambda s, fr, dc, m: optimize_tool(s, fr, dc, m),
|
| 56 |
inputs=[speed, feed_rate, depth_of_cut, material],
|
| 57 |
-
|
| 58 |
)
|
| 59 |
|
| 60 |
-
|
| 61 |
app.launch()
|
|
|
|
| 23 |
outputs=[die_output, visualization_output],
|
| 24 |
)
|
| 25 |
|
| 26 |
+
with gr.Tab("Stress Analysis"):
|
| 27 |
gr.Markdown("### Select Simulation Tool and Enter Parameters for Stress Analysis")
|
| 28 |
force = gr.Number(label="Force (N)", value=10000)
|
| 29 |
die_width = gr.Number(label="Width (m)", value=0.05)
|
|
|
|
| 38 |
stress_chart = gr.Plot()
|
| 39 |
stress_button = gr.Button("Analyze Stress")
|
| 40 |
stress_button.click(
|
| 41 |
+
lambda f, dw, dh, ms, tc, a, em, fs: stress_analysis(f, dw, dh, ms, tc, a, em, fs),
|
| 42 |
+
inputs=[force, die_width, die_height, material_strength, temperature_change, alpha, elastic_modulus, fatigue_strength],
|
| 43 |
+
outputs=[safety_factor_output, stress_chart],
|
| 44 |
)
|
| 45 |
|
| 46 |
with gr.Tab("Tool Optimization"):
|
| 47 |
gr.Markdown("### Enter Machining Parameters for Tool Optimization")
|
| 48 |
speed = gr.Number(label="Cutting Speed (m/min)", value=100)
|
| 49 |
feed_rate = gr.Number(label="Feed Rate (mm/rev)", value=0.2)
|
| 50 |
+
depth_of_cut = gr.Number(label="Depth of Cut (mm)", value=1.0)
|
| 51 |
+
material = gr.Dropdown(choices=["Steel", "Aluminum", "Titanium"], label="Material", value="Steel")
|
| 52 |
optimization_results = gr.JSON(label="Optimization Results")
|
| 53 |
optimize_button = gr.Button("Optimize Tool")
|
| 54 |
optimize_button.click(
|
| 55 |
lambda s, fr, dc, m: optimize_tool(s, fr, dc, m),
|
| 56 |
inputs=[speed, feed_rate, depth_of_cut, material],
|
| 57 |
+
outputs=optimization_results,
|
| 58 |
)
|
| 59 |
|
| 60 |
+
# Launch the app
|
| 61 |
app.launch()
|