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 = """

Welcome to world of AI with Prince

Online Food Order Prediction using Python.


""" 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= """

Online Food Order Prediction with Machine Learning .


""" st.markdown(html_temp_about1, unsafe_allow_html=True) html_temp4 = """

Thanks for Visiting





""" st.markdown(html_temp4, unsafe_allow_html=True) else: pass if __name__ == "__main__": main() # import streamlit as st