Devashri commited on
Commit
e352d7c
·
verified ·
1 Parent(s): 972c721

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from SIR_model import main as run_sir_model
3
+
4
+ # Streamlit app title
5
+ st.title('SIR Model Simulation')
6
+
7
+ # Introduction
8
+ st.write('This application simulates and visualizes the SIR model for infectious disease spread.')
9
+
10
+ # Buttons to control the simulation
11
+ if st.button('Run SIR Model'):
12
+ # Call the modified run_sir_model function with "run" mode
13
+ figures = run_sir_model(mode="run")
14
+ for fig in figures:
15
+ st.pyplot(fig)
16
+ st.success('Model executed successfully.')
17
+
18
+ if st.button('Generate Graph'):
19
+ # Call the modified run_sir_model function with "graph" mode
20
+ image_path=run_sir_model(mode="graph")
21
+ st.image(image_path,caption="SIR Model Graph")
22
+ st.success('Graph generated successfully.')
23
+
24
+ # Instructions or description can be added here
25
+ 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.')