Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,7 +78,7 @@ def plotdata(t, s, i,r,R0, e=None):
|
|
78 |
return fig
|
79 |
|
80 |
#final model
|
81 |
-
def SIR(country,R0,t_infective):
|
82 |
#R0 = 0.57 - 1.25
|
83 |
|
84 |
# parameter values
|
@@ -86,17 +86,12 @@ def SIR(country,R0,t_infective):
|
|
86 |
t_infective = t_infective
|
87 |
|
88 |
# initial number of infected and recovered individuals
|
89 |
-
i_initial = all_location[country]['total_cases'].iloc[0]/
|
90 |
r_initial = 0.00
|
91 |
s_initial = 1 - i_initial - r_initial
|
92 |
|
93 |
gamma = 1/t_infective
|
94 |
beta = R0*gamma
|
95 |
-
|
96 |
-
# initial number of infected and recovered individuals
|
97 |
-
i_initial = all_location[country]['new_cases'].sum()/pop_dict[country]
|
98 |
-
r_initial = 0.00
|
99 |
-
s_initial = 1 - i_initial - r_initial
|
100 |
|
101 |
t = np.linspace(0, 3000, 3000)
|
102 |
x_initial = s_initial, i_initial, r_initial
|
@@ -104,7 +99,7 @@ def SIR(country,R0,t_infective):
|
|
104 |
s, i, r = soln.T
|
105 |
e = None
|
106 |
|
107 |
-
scaler = all_location[country]['total_cases'].apply(lambda x : x/
|
108 |
rangee = len(all_location[country]['total_cases'])
|
109 |
rmpe = mean_absolute_percentage_error(scaler,i[0:rangee])
|
110 |
|
@@ -148,7 +143,7 @@ def main():
|
|
148 |
if clicked:
|
149 |
|
150 |
# Show SIR
|
151 |
-
SIR_param = SIR(country_code,R0,recovery)
|
152 |
|
153 |
st.pyplot(SIR_param[-1])
|
154 |
st.pyplot(compare_plt(country_code,pop))
|
|
|
78 |
return fig
|
79 |
|
80 |
#final model
|
81 |
+
def SIR(country,R0,t_infective,pop):
|
82 |
#R0 = 0.57 - 1.25
|
83 |
|
84 |
# parameter values
|
|
|
86 |
t_infective = t_infective
|
87 |
|
88 |
# initial number of infected and recovered individuals
|
89 |
+
i_initial = all_location[country]['total_cases'].iloc[0]/pop
|
90 |
r_initial = 0.00
|
91 |
s_initial = 1 - i_initial - r_initial
|
92 |
|
93 |
gamma = 1/t_infective
|
94 |
beta = R0*gamma
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
t = np.linspace(0, 3000, 3000)
|
97 |
x_initial = s_initial, i_initial, r_initial
|
|
|
99 |
s, i, r = soln.T
|
100 |
e = None
|
101 |
|
102 |
+
scaler = all_location[country]['total_cases'].apply(lambda x : x/pop)
|
103 |
rangee = len(all_location[country]['total_cases'])
|
104 |
rmpe = mean_absolute_percentage_error(scaler,i[0:rangee])
|
105 |
|
|
|
143 |
if clicked:
|
144 |
|
145 |
# Show SIR
|
146 |
+
SIR_param = SIR(country_code,R0,recovery,pop)
|
147 |
|
148 |
st.pyplot(SIR_param[-1])
|
149 |
st.pyplot(compare_plt(country_code,pop))
|