File size: 3,616 Bytes
c804657
009587a
c804657
8facc60
 
c804657
 
8facc60
 
c804657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecef131
c804657
 
 
 
 
 
 
ecef131
c804657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecef131
c804657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import streamlit as st
import pandas as pd
import numpy as np
import joblib


# load the model from disk
filename = 'finalized_model.sav'
loaded_model = joblib.load(filename)


def generate_prediction(input_array):
    ans = loaded_model.predict(input_array)

    return ans


def main():
    # Face Analysis Application #
    st.title("Online Food Order Prediction")
    activiteis = ["Home", "Prediction","About"]
    choice = st.sidebar.selectbox("Select Activity", activiteis)
        
    if choice == "Home":
        html_temp_home1 = """<div style="background-color:#6D7B8D;padding:10px">
                                            <h3 style="color:yellow;text-align:center;"> Welcome to world of AI with Prince </h3>
                                            <h4 style="color:white;text-align:center;">
                                            Online Food Order Prediction using Python.</h4>
                                            </div>
                                            </br>"""
        st.markdown(html_temp_home1, unsafe_allow_html=True)
        st.write("""
                  Predicting the premium of health insurance
                 """)
    if choice == "Prediction":
        val1 = 0
        val2 = 0
        val3 = 0
        val4 = 0
        
        st.header("Predicting the premium of health insurance")
        # Define the input fields
        age = st.number_input("Age", min_value=0, max_value=120, value=30, step=1)
        
        Bmi = st.number_input("bmi", min_value=0, max_value=1000000, value=50000, step=1000)
        
        children = st.number_input("children", min_value=1, max_value=10, value=4, step=1)
        
        gender = { "Male" :1,"Female" : 0}
        Gender_index = st.selectbox("Gender", options=list(gender.keys()))
        Gender = gender[Gender_index]


        smoke = { "Yes" :1,"No" : 0}
        Smoke = st.selectbox("Smoke", options=list(smoke.keys()))
        Snoke = smoke[Smoke]


        
        Region = {"northeast" : 1, "northwest": 2,"southeast" : 3, "southwest":4}
        Region = st.selectbox("Region", options=list(smoke.keys()))
        Region = smoke[Smoke]
        if Region == 1:
            val1 = 1
        if Region == 2:
            val2 = 1
        if Region == 3:
            val3 = 1
        if Region == 4:
            val4 = 1


        # Create a button to trigger the model
        if st.button("Predict"):
        # TODO: Replace with your model code
            prediction = generate_prediction(np.array([[age, Bmi, children, Gender, val1, val2, val3, val4 ]]))
        
            # Show the prediction
            st.write("Prediction:", prediction[0])

    elif choice == "About":
        st.subheader("About this app")
        html_temp_about1= """<div style="background-color:#6D7B8D;padding:10px">
                                    <h4 style="color:white;text-align:center;">
                                    Predicting the premium of health insurance .</h4>
                                    </div>
                                    </br>"""
        st.markdown(html_temp_about1, unsafe_allow_html=True)

        html_temp4 = """
                             		<div style="background-color:#98AFC7;padding:10px">
                             		<h4 style="color:white;text-align:center;">Thanks for Visiting</h4>
                             		</div>
                             		<br></br>
                             		<br></br>"""

        st.markdown(html_temp4, unsafe_allow_html=True)

    else:
        pass

if __name__ == "__main__":
    main()



# import streamlit as st