bqpxben commited on
Commit
dc1b163
1 Parent(s): 200ba4c

Upload 4 files

Browse files
app.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ import streamlit as st
4
+
5
+ # Load the models
6
+ model_acc = joblib.load('model_acc.joblib') # Model for accommodation cost prediction
7
+ model_tp = joblib.load('model_tp.joblib') # Model for transportation cost prediction
8
+
9
+ def main():
10
+ st.title("Angie Travel Assistant")
11
+
12
+ with st.form("questionnaire"):
13
+ day = st.slider("Duration of Traveling", min_value=1, max_value=60)
14
+ acc_type = st.selectbox("Preferred Accommodation Type", unique_value_acc)
15
+ tp_type = st.selectbox("Preferred Transportation Type", unique_value_tp)
16
+
17
+ clicked = st.form_submit_button("Predict total expense")
18
+ if clicked:
19
+ # Prepare input data for both models
20
+ data_acc = pd.DataFrame({
21
+ 'duration_(days)': [day],
22
+ 'accommodation_cost': [0], # You can set this to 0 since it's not used for prediction
23
+ f'accommodation_type_{acc_type}': [1]
24
+ })
25
+
26
+ data_tp = pd.DataFrame({
27
+ 'duration_(days)': [day],
28
+ 'transportation_cost': [0], # You can set this to 0 since it's not used for prediction
29
+ f'transportation_type_{tp_type}': [1]
30
+ })
31
+
32
+ # Predict expenses using both models
33
+ result1 = model_acc.predict(data_acc)
34
+ result2 = model_tp.predict(data_tp)
35
+
36
+ # Calculate total expense
37
+ total_expense = result1[0] + result2[0]
38
+
39
+ st.success(f'The predicted total expense is {total_expense}')
40
+
41
+ if __name__ == '__main__':
42
+ main()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ joblib
2
+ pandas
3
+ scikit-learn==1.2.2
4
+ xgboost==1.7.6
5
+ altair<5
unique_values_acc.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5aeac4e2dd7ca83ae6a70fa17cd84085914252b58d9084cbca89e27e81c47066
3
+ size 676
unique_values_tp.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2312aae4c2aa70db3d3bef93240e0caa38bc92e29e86d314b428634ca33f67cd
3
+ size 580