Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -137,6 +137,25 @@ def main():
|
|
137 |
R0 = st.slider("Basic Reproduction Number (R0)", 0.57, 3.00, 0.57)# user's input
|
138 |
country_code = code[country][0]
|
139 |
pop = pop_dict[country_code]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
|
141 |
# clicked==True only when the button is clicked
|
142 |
clicked = st.form_submit_button("Show Graph")
|
@@ -146,12 +165,12 @@ def main():
|
|
146 |
SIR_param = SIR(country_code,R0,recovery,pop)
|
147 |
|
148 |
st.pyplot(SIR_param[-1])
|
149 |
-
|
150 |
st.success("SIR model parameters for "+str(country)+" is")
|
151 |
st.success("R0 = "+str(SIR_param[0]))
|
152 |
st.success("Beta = "+str(SIR_param[2]))
|
153 |
st.success("Gamma = "+str(SIR_param[3]))
|
154 |
-
st.success("RMPE = "+str(SIR_param[4]+"%")
|
155 |
|
156 |
# Run main()
|
157 |
if __name__ == "__main__":
|
|
|
137 |
R0 = st.slider("Basic Reproduction Number (R0)", 0.57, 3.00, 0.57)# user's input
|
138 |
country_code = code[country][0]
|
139 |
pop = pop_dict[country_code]
|
140 |
+
|
141 |
+
fig = plt.figure(figsize=(12,6))
|
142 |
+
ax = [fig.add_subplot(121, axisbelow=True),fig.add_subplot(122)]
|
143 |
+
ax[0].set_title('Monkeypox confirmed cases')
|
144 |
+
ax[0].plot(all_location[country]['total_cases'],lw=3,label='Infective')
|
145 |
+
ax[0].set_xlabel('Days')
|
146 |
+
ax[0].set_ylabel('Number of cases')
|
147 |
+
ax[0].legend()
|
148 |
+
|
149 |
+
scaler = all_location[country]['total_cases'].apply(lambda x : x/pop)
|
150 |
+
ax[1].set_title('Monkeypox confirmed cases compare with model')
|
151 |
+
ax[1].plot(scaler,lw=3,label='Real Infective')
|
152 |
+
ax[1].plot(i,lw=3,label='SIR model Infective')
|
153 |
+
ax[1].set_ylim(0,0.00005)
|
154 |
+
ax[1].set_xlim(0,200)
|
155 |
+
ax[1].set_xlabel('Days')
|
156 |
+
ax[1].set_ylabel('Fraction Number of cases')
|
157 |
+
ax[1].legend()
|
158 |
+
plt.tight_layout()
|
159 |
|
160 |
# clicked==True only when the button is clicked
|
161 |
clicked = st.form_submit_button("Show Graph")
|
|
|
165 |
SIR_param = SIR(country_code,R0,recovery,pop)
|
166 |
|
167 |
st.pyplot(SIR_param[-1])
|
168 |
+
st.pyplot(fig)
|
169 |
st.success("SIR model parameters for "+str(country)+" is")
|
170 |
st.success("R0 = "+str(SIR_param[0]))
|
171 |
st.success("Beta = "+str(SIR_param[2]))
|
172 |
st.success("Gamma = "+str(SIR_param[3]))
|
173 |
+
st.success("RMPE = "+str(SIR_param[4])+"%")
|
174 |
|
175 |
# Run main()
|
176 |
if __name__ == "__main__":
|