Update app.py
Browse files
app.py
CHANGED
|
@@ -26,10 +26,21 @@ beta = st.slider("Infection Rate (β)", min_value=0.0, max_value=1.0, value=0.3,
|
|
| 26 |
gamma = st.slider("Recovery Rate (γ)", min_value=0.0, max_value=1.0, value=0.1, step=0.01)
|
| 27 |
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Call the modified run_sir_model function with user input and slider values
|
| 30 |
figures = run_sir_model(total_population, initial_infected, initial_recovered, beta, gamma, mode="run")
|
| 31 |
for fig in figures:
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
st.success('Model executed successfully with user input and slider values.')
|
| 34 |
|
| 35 |
# Buttons to control the simulation
|
|
|
|
| 26 |
gamma = st.slider("Recovery Rate (γ)", min_value=0.0, max_value=1.0, value=0.1, step=0.01)
|
| 27 |
|
| 28 |
|
| 29 |
+
# Call the modified run_sir_model function with user input and slider values
|
| 30 |
+
# figures = run_sir_model(total_population, initial_infected, initial_recovered, beta, gamma, mode="run")
|
| 31 |
+
# for fig in figures:
|
| 32 |
+
# st.pyplot(fig)
|
| 33 |
+
# st.success('Model executed successfully with user input and slider values.')
|
| 34 |
+
|
| 35 |
# Call the modified run_sir_model function with user input and slider values
|
| 36 |
figures = run_sir_model(total_population, initial_infected, initial_recovered, beta, gamma, mode="run")
|
| 37 |
for fig in figures:
|
| 38 |
+
if isinstance(fig, matplotlib.animation.FuncAnimation):
|
| 39 |
+
st.write("Animated Plot:")
|
| 40 |
+
st.pyplot(fig)
|
| 41 |
+
else:
|
| 42 |
+
st.pyplot(fig)
|
| 43 |
+
|
| 44 |
st.success('Model executed successfully with user input and slider values.')
|
| 45 |
|
| 46 |
# Buttons to control the simulation
|