Devashri commited on
Commit
98a2d2f
·
verified ·
1 Parent(s): eb3a999

Update SIR_model.py

Browse files
Files changed (1) hide show
  1. SIR_model.py +13 -6
SIR_model.py CHANGED
@@ -18,12 +18,19 @@ def main(mode=None):
18
  sir_graph = Graph(id="SIR_Graph")
19
  sir_model.graphs.append(sir_graph)
20
 
21
- # Parameters for the model
22
- total_population = 1000
23
- initial_infected = 1
24
- initial_recovered = 0
25
- beta = 0.3 # Infection rate
26
- gamma = 0.1 # Recovery rate
 
 
 
 
 
 
 
27
  initial_susceptible = total_population - initial_infected - initial_recovered
28
 
29
 
 
18
  sir_graph = Graph(id="SIR_Graph")
19
  sir_model.graphs.append(sir_graph)
20
 
21
+ # Get user inputs for model parameters
22
+ total_population = st.number_input("Total Population", min_value=1, value=1000, step=1)
23
+ initial_infected = st.number_input("Initial Infected Population", min_value=0, max_value=total_population, value=1)
24
+ initial_recovered = st.number_input("Initial Recovered Population", min_value=0, max_value=total_population - initial_infected, value=0)
25
+ beta = st.slider("Infection Rate (β)", min_value=0.0, max_value=1.0, value=0.3, step=0.01)
26
+ gamma = st.slider("Recovery Rate (γ)", min_value=0.0, max_value=1.0, value=0.1, step=0.01)
27
+
28
+ # # Parameters for the model
29
+ # total_population = 1000
30
+ # initial_infected = 1
31
+ # initial_recovered = 0
32
+ # beta = 0.3 # Infection rate
33
+ # gamma = 0.1 # Recovery rate
34
  initial_susceptible = total_population - initial_infected - initial_recovered
35
 
36