Update app.py
Browse files
app.py
CHANGED
|
@@ -134,4 +134,26 @@ plt.title("Landing distribution (PDF approx)")
|
|
| 134 |
plt.xlabel("Landing x-position (m)")
|
| 135 |
plt.ylabel("Probability density")
|
| 136 |
plt.legend()
|
| 137 |
-
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
plt.xlabel("Landing x-position (m)")
|
| 135 |
plt.ylabel("Probability density")
|
| 136 |
plt.legend()
|
| 137 |
+
plt.show()
|
| 138 |
+
import gradio as gr
|
| 139 |
+
|
| 140 |
+
def run_sim():
|
| 141 |
+
landings, outcomes = monte_carlo(2000)
|
| 142 |
+
|
| 143 |
+
result_str = f"""
|
| 144 |
+
Valid: {outcomes['valid']}
|
| 145 |
+
Net: {outcomes['net']}
|
| 146 |
+
Undershoot: {outcomes['undershoot']}
|
| 147 |
+
Overshoot: {outcomes['overshoot']}
|
| 148 |
+
"""
|
| 149 |
+
|
| 150 |
+
return result_str
|
| 151 |
+
|
| 152 |
+
demo = gr.Interface(
|
| 153 |
+
fn=run_sim,
|
| 154 |
+
inputs=[],
|
| 155 |
+
outputs="text",
|
| 156 |
+
title="Table Tennis Monte Carlo Simulator"
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
demo.launch()
|