Spaces:
Build error
Build error
| import joblib | |
| import pandas as pd | |
| import streamlit as st | |
| model_tp = joblib.load('model_tp_xg.joblib') | |
| model_acc = joblib.load('model_acc_xg.joblib') | |
| unique_values = joblib.load('unique_values.joblib') | |
| unique_acc = unique_values["accommodation_type"] | |
| unique_trans = unique_values["transportation_type"] | |
| unique_city = unique_values["city"] | |
| unique_country = unique_values["country"] | |
| def main(): | |
| st.title("Angie Assistance") | |
| with st.form("questionaire"): | |
| day = st.number_input("Stay Duration") | |
| trans = st.selectbox("Preferred Transportation", unique_trans) | |
| acc = st.selectbox("Preferred Accommodation",unique_acc) | |
| city = st.selectbox("City",unique_city) | |
| country = st.selectbox("Country", unique_country) | |
| clicked = st.form_submit_button("Predict expense of transportaion and accommodation") | |
| if clicked: | |
| result1 = model_tp.predict(pd.DataFrame({"duration_(days)": [day], | |
| "accommodation_type": [acc], | |
| "transportation_type": [trans], | |
| "city": [city], | |
| "country": [country]})) | |
| result2 = model_acc.predict(pd.DataFrame({"duration_(days)": [day], | |
| "accommodation_type": [acc], | |
| "transportation_type": [trans], | |
| "city": [city], | |
| "country": [country]})) | |
| result = result1[0] + result2[0] | |
| st.success('The predicted expense is {:.2f}'.format(result)) | |
| if __name__=='__main__': | |
| main() | |