Spaces:
Runtime error
Runtime error
File size: 4,004 Bytes
836f506 ea99c2a 836f506 ea99c2a 836f506 ea99c2a 836f506 6a8123c 69e088e e0e305b 6a8123c 69e088e 6a8123c 69e088e 6a8123c 64b6c4b 69e088e 6a8123c 1ce8ce6 6a8123c 69e088e 836f506 6a8123c ea99c2a 0d86860 6a8123c 5e26834 4497d94 5e26834 | 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 | import streamlit as st
import joblib
import numpy as np
# load model
loaded_model = joblib.load('model.pkl')
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("""
Online Food Order Prediction
""")
if choice == "Prediction":
st.header("Online Food Order Prediction")
# Define the input fields
age = st.number_input("Age", min_value=0, max_value=120, value=30, step=1)
income = st.number_input("Income", min_value=0, max_value=1000000, value=50000, step=1000)
family_size = st.number_input("Family Size", min_value=1, max_value=10, value=4, step=1)
pin = st.number_input("Pin", min_value=100000, max_value=999999, value=500000, step=1)
gender = { "Male" :1,"Female" : 2}
Gender_index = st.selectbox("Gender", options=list(gender.keys()))
Gender = gender[Gender_index]
Mirrage = {"Single" : 1, "Married": 2,"Not Revealed" : 3}
Marital_index = st.selectbox("Marital Status", options=list(Mirrage.keys()))
Marital_status = Mirrage[Marital_index]
occupation_dict = {"Student" :1, "Employee" : 2, "Self Employeed" : 3, "House wife" : 4}
occupation_index = st.selectbox("Marital Status", options=list(occupation_dict.keys()))
occupation = occupation_dict[occupation_index]
educational_level = {"Graduate": 1, "Post Graduate":2, "Ph.D":3, "School" :4, "Uneducated" :5}
educational_index = st.selectbox("educational_level", options=list(educational_level.keys()))
education = educational_level[educational_index]
Review_dict = {"Positive": 1, "Negative": 0}
Review_index = st.selectbox("Review", options=list(Review_dict.keys()))
Review = Review_dict[Review_index]
# Create a button to trigger the model
if st.button("Predict"):
# TODO: Replace with your model code
prediction = generate_prediction(np.array([[age, income, family_size, pin, Gender, Review, Marital_status, occupation, education]]))
# 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;">
Online Food Order Prediction with Machine Learning .</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
|