Priyanka-Kumavat commited on
Commit
32b6f07
1 Parent(s): 97d7d24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -49
app.py CHANGED
@@ -5,6 +5,7 @@ import numpy as np
5
  import matplotlib.pyplot as plt
6
  import seaborn as sns
7
  import pickle
 
8
 
9
  from datetime import datetime
10
  from datetime import timedelta
@@ -36,64 +37,64 @@ with open('timeBand_le.pkl','rb') as file2:
36
  # previous_number_of_repairs =
37
  # st.sidebar.number_input('Enter the Previous Number of Repairs Undergone 0 to 5 )',min_value=0,max_value=5,step=1)
38
 
39
- # DATA from user
40
- def user_report():
41
 
42
- Share = round(float(st.sidebar.slider('Share', 0.000000, 100.000000, 0.611246)), 6)
43
- AMA = round(float(st.sidebar.slider('AMA', 0.000000, 45.000000, 4.196084)), 6)
44
- rate = round(float(st.sidebar.slider('rate', 0.000000, 1.500000, 0.018516)), 6)
45
- daily_reach = round(float(st.sidebar.slider('daily reach', 0.000000, 300.000000, 36.23)), 6)
46
- cume_reach = round(float(st.sidebar.slider('cume reach', 0.000000, 300.000000, 36.231006)), 6)
47
 
48
- # Output: {'Friday': 0, 'Monday': 1, 'Saturday': 2, 'Sunday': 3, 'Thursday': 4, 'Tuesday': 5, 'Wednesday': 6}
49
 
50
- Week_Day_Encoded = st.sidebar.selectbox("Week Day",
51
- ("Monday", "Tuesday","Wednesday","Thursday","Friday", "Saturday", "Sunday" ))
52
- if Week_Day_Encoded=='Monday':
53
- Week_Day_Encoded=1
54
- elif Week_Day_Encoded=="Tuesday":
55
- Week_Day_Encoded=5
56
- elif Week_Day_Encoded=="Wednesday":
57
- Week_Day_Encoded=6
58
- elif Week_Day_Encoded=="Thursday":
59
- Week_Day_Encoded =4
60
- elif Week_Day_Encoded=="Friday":
61
- Week_Day_Encoded =0
62
- elif Week_Day_Encoded=="Saturday":
63
- Week_Day_Encoded =2
64
- else:
65
- Week_Day_Encoded=3
66
 
67
- user_report_data = {
68
- 'Share': Share,
69
- 'AMA': AMA,
70
- 'rate': rate,
71
- 'daily reach': daily_reach,
72
- 'cume reach': cume_reach,
73
- 'Week_Day_Encoded': Week_Day_Encoded,
74
- 'Time_Band_Encoded': Time_Band_Encoded}
75
- report_data = pd.DataFrame(user_report_data, index=[0])
76
 
77
- return report_data
78
 
79
- #Customer Data
80
- user_data = user_report()
81
- st.subheader("Entered Details")
82
- st.write(user_data)
83
 
84
 
85
- # define the prediction function
86
- def predict_unrolled_value(user_data):
87
 
88
- # make the prediction using the loaded model and input data
89
- predicted_unrolled_value = model1.predict(user_data)
90
 
91
- # return the predicted max number of repairs as output
92
- return np.round(predicted_unrolled_value[0])
93
 
94
 
95
- # Function calling
96
- y_pred = int(predict_unrolled_value(user_data))
97
- st.write("Click here to see the Predictions")
98
- if st.button("Predict"):
99
- st.subheader(f"Predicted Unrolled Value: {y_pred} ")
 
5
  import matplotlib.pyplot as plt
6
  import seaborn as sns
7
  import pickle
8
+ import os
9
 
10
  from datetime import datetime
11
  from datetime import timedelta
 
37
  # previous_number_of_repairs =
38
  # st.sidebar.number_input('Enter the Previous Number of Repairs Undergone 0 to 5 )',min_value=0,max_value=5,step=1)
39
 
40
+ # # DATA from user
41
+ # def user_report():
42
 
43
+ # Share = round(float(st.sidebar.slider('Share', 0.000000, 100.000000, 0.611246)), 6)
44
+ # AMA = round(float(st.sidebar.slider('AMA', 0.000000, 45.000000, 4.196084)), 6)
45
+ # rate = round(float(st.sidebar.slider('rate', 0.000000, 1.500000, 0.018516)), 6)
46
+ # daily_reach = round(float(st.sidebar.slider('daily reach', 0.000000, 300.000000, 36.23)), 6)
47
+ # cume_reach = round(float(st.sidebar.slider('cume reach', 0.000000, 300.000000, 36.231006)), 6)
48
 
49
+ # # Output: {'Friday': 0, 'Monday': 1, 'Saturday': 2, 'Sunday': 3, 'Thursday': 4, 'Tuesday': 5, 'Wednesday': 6}
50
 
51
+ # Week_Day_Encoded = st.sidebar.selectbox("Week Day",
52
+ # ("Monday", "Tuesday","Wednesday","Thursday","Friday", "Saturday", "Sunday" ))
53
+ # if Week_Day_Encoded=='Monday':
54
+ # Week_Day_Encoded=1
55
+ # elif Week_Day_Encoded=="Tuesday":
56
+ # Week_Day_Encoded=5
57
+ # elif Week_Day_Encoded=="Wednesday":
58
+ # Week_Day_Encoded=6
59
+ # elif Week_Day_Encoded=="Thursday":
60
+ # Week_Day_Encoded =4
61
+ # elif Week_Day_Encoded=="Friday":
62
+ # Week_Day_Encoded =0
63
+ # elif Week_Day_Encoded=="Saturday":
64
+ # Week_Day_Encoded =2
65
+ # else:
66
+ # Week_Day_Encoded=3
67
 
68
+ # user_report_data = {
69
+ # 'Share': Share,
70
+ # 'AMA': AMA,
71
+ # 'rate': rate,
72
+ # 'daily reach': daily_reach,
73
+ # 'cume reach': cume_reach,
74
+ # 'Week_Day_Encoded': Week_Day_Encoded,
75
+ # 'Time_Band_Encoded': Time_Band_Encoded}
76
+ # report_data = pd.DataFrame(user_report_data, index=[0])
77
 
78
+ # return report_data
79
 
80
+ # #Customer Data
81
+ # user_data = user_report()
82
+ # st.subheader("Entered Details")
83
+ # st.write(user_data)
84
 
85
 
86
+ # # define the prediction function
87
+ # def predict_unrolled_value(user_data):
88
 
89
+ # # make the prediction using the loaded model and input data
90
+ # predicted_unrolled_value = model1.predict(user_data)
91
 
92
+ # # return the predicted max number of repairs as output
93
+ # return np.round(predicted_unrolled_value[0])
94
 
95
 
96
+ # # Function calling
97
+ # y_pred = int(predict_unrolled_value(user_data))
98
+ # st.write("Click here to see the Predictions")
99
+ # if st.button("Predict"):
100
+ # st.subheader(f"Predicted Unrolled Value: {y_pred} ")