-
Notifications
You must be signed in to change notification settings - Fork 0
/
sir_app.py
25 lines (20 loc) · 1014 Bytes
/
sir_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import streamlit as st
from SIR_model import main as run_sir_model
# Streamlit app title
st.title('SIR Model Simulation')
# Introduction
st.write('This application simulates and visualizes the SIR model for infectious disease spread.')
# Buttons to control the simulation
if st.button('Run SIR Model'):
# Call the modified run_sir_model function with "run" mode
figures = run_sir_model(mode="run")
for fig in figures:
st.pyplot(fig)
st.success('Model executed successfully.')
if st.button('Generate Graph'):
# Call the modified run_sir_model function with "graph" mode
image_path=run_sir_model(mode="graph")
st.image(image_path,caption="SIR Model Graph")
st.success('Graph generated successfully.')
# Instructions or description can be added here
st.write('The SIR model divides the population into three categories: Susceptible (S), Infected (I), and Recovered (R). The model simulates how an infectious disease spreads and is managed within a population over time.')