File size: 1,030 Bytes
0c60a31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import streamlit as st
import pickle
import numpy as np

st.title("COVID19 GLOBAL FORECAST")
coc=st.number_input("Confirmed Cases")
lat=st.number_input("Latitude")
lon=st.number_input("Longitude")
model_selection=st.radio("Select your model",("Regression","Classification"))
if model_selection is "Regression":
    file_path = 'covid1_model.pkl'
    with open(file_path, 'rb') as file:
        model = pickle.load(file)
    data=[coc,lat,lon]
    if st.button("Predict"):
       data=np.array(data)
       if len(data.shape) == 1:
          data = np.expand_dims(data, axis=0) 
       prediction=model.predict(data)
       st.write(prediction)
else:
    file_path = 'covid2_model2.pkl'
    with open(file_path, 'rb') as file:
        model = pickle.load(file)
    data=[lat,lon]
    if st.button("Predict"):
       data=np.array(data)
       if len(data.shape) == 1:
          data = np.expand_dims(data, axis=0)
    prediction=model.predict(data)
    pred=np.argmax(prediction)
    st.write(pred)