Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,7 +61,8 @@ def plotdata(t, s, i,r,R0, e=None):
|
|
61 |
a.legend()
|
62 |
|
63 |
plt.tight_layout()
|
64 |
-
|
|
|
65 |
|
66 |
#final model
|
67 |
def SIR(country,t_infective):
|
@@ -83,9 +84,8 @@ def SIR(country,t_infective):
|
|
83 |
s, i, r = soln.T
|
84 |
e = None
|
85 |
|
86 |
-
plotdata(t, s, i,r,R0)
|
87 |
|
88 |
-
return R0,t_infective,gamma,beta
|
89 |
|
90 |
def main():
|
91 |
st.title("SIR Model for Monkeypox")
|
@@ -104,12 +104,12 @@ def main():
|
|
104 |
# Show SIR
|
105 |
SIR_param = SIR(country,recovery)
|
106 |
|
107 |
-
st.success(st.pyplot(all_location[country]['total_cases']
|
108 |
-
st.success(st.pyplot(SIR(country,recovery)))
|
109 |
st.success("SIR model parameters for "+str(country)+" is")
|
110 |
-
st.success("R0 = "+str(SIR_param[
|
111 |
-
st.success("Beta = "+str(SIR_param[
|
112 |
-
st.success("Gamma = "+str(SIR_param[
|
113 |
|
114 |
# Run main()
|
115 |
if __name__ == "__main__":
|
|
|
61 |
a.legend()
|
62 |
|
63 |
plt.tight_layout()
|
64 |
+
|
65 |
+
return fig
|
66 |
|
67 |
#final model
|
68 |
def SIR(country,t_infective):
|
|
|
84 |
s, i, r = soln.T
|
85 |
e = None
|
86 |
|
|
|
87 |
|
88 |
+
return plotdata(t, s, i,r,R0),R0,t_infective,gamma,beta
|
89 |
|
90 |
def main():
|
91 |
st.title("SIR Model for Monkeypox")
|
|
|
104 |
# Show SIR
|
105 |
SIR_param = SIR(country,recovery)
|
106 |
|
107 |
+
st.success(st.pyplot(plt.plot(all_location[country]['total_cases'])))
|
108 |
+
st.success(st.pyplot(SIR(country,recovery)[0]))
|
109 |
st.success("SIR model parameters for "+str(country)+" is")
|
110 |
+
st.success("R0 = "+str(SIR_param[1]))
|
111 |
+
st.success("Beta = "+str(SIR_param[4]))
|
112 |
+
st.success("Gamma = "+str(SIR_param[3]))
|
113 |
|
114 |
# Run main()
|
115 |
if __name__ == "__main__":
|