Priyanka-Kumavat commited on
Commit
3c8506c
1 Parent(s): 29c5c9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -7
app.py CHANGED
@@ -21,7 +21,9 @@ warnings.filterwarnings('ignore')
21
 
22
  st.title("Predict Unrolled Values")
23
  st.sidebar.header('Enter the Details here')
24
- st.write("""Regression Model""")
 
 
25
 
26
  # load the saved model using pickle
27
  with open('aajTak_model.pkl', 'rb') as file:
@@ -47,13 +49,17 @@ def user_report():
47
  # Share = round(float(st.sidebar.slider('Share', 0.000000, 100.000000, 0.611246, step=0.000001)), 6)
48
  # AMA = round(float(st.sidebar.slider('AMA', 0.000000, 45.000000, 4.196084, step=0.000001)), 6)
49
  # rate = round(float(st.sidebar.slider('rate', 0.000000, 1.500000, 0.018516, step=0.000001)), 6)
 
 
50
 
 
51
  Share = round(float(st.sidebar.number_input('Share', 0.0, 100.0, 0.611246, step=0.000001)), 6)
52
  AMA = round(float(st.sidebar.number_input('AMA', 0.0, 45.0, 4.196084, step=0.000001)), 6)
53
  rate = round(float(st.sidebar.number_input('rate', 0.0, 1.5, 0.018516, step=0.000001)), 6)
 
 
54
 
55
- daily_reach = round(float(st.sidebar.slider('daily reach', 0.000000, 300.000000, 36.23)), 6)
56
- cume_reach = round(float(st.sidebar.slider('cume reach', 0.000000, 300.000000, 36.231006)), 6)
57
 
58
  # Share = st.sidebar.slider('Share', 0, 100, 0)
59
  # AMA = st.sidebar.slider('AMA', 0, 45, 4)
@@ -123,12 +129,23 @@ def predict_unrolled_value(user_data):
123
  # make the prediction using the loaded model and input data
124
  predicted_unrolled_value = model.predict(user_data)
125
 
126
- # return the predicted max number of repairs as output
127
- return np.round(predicted_unrolled_value[0])
128
 
129
 
130
  # Function calling
131
  y_pred = int(predict_unrolled_value(user_data))
132
- st.write("Click here to see the Predictions")
133
- if st.button("Predict"):
 
 
 
 
 
 
 
 
 
 
 
134
  st.subheader(f"Predicted Unrolled Value: {y_pred} ")
 
21
 
22
  st.title("Predict Unrolled Values")
23
  st.sidebar.header('Enter the Details here')
24
+ st.write("""This Random Forest Regressor model helps to forecast unrolled values with impressive accuracy.
25
+ Leveraging the strength of the Random Forest technique, we can now make reliable predictions that
26
+ enable us to plan and strategize effectively in the fast-paced media landscape.""")
27
 
28
  # load the saved model using pickle
29
  with open('aajTak_model.pkl', 'rb') as file:
 
49
  # Share = round(float(st.sidebar.slider('Share', 0.000000, 100.000000, 0.611246, step=0.000001)), 6)
50
  # AMA = round(float(st.sidebar.slider('AMA', 0.000000, 45.000000, 4.196084, step=0.000001)), 6)
51
  # rate = round(float(st.sidebar.slider('rate', 0.000000, 1.500000, 0.018516, step=0.000001)), 6)
52
+ # daily_reach = round(float(st.sidebar.slider('daily reach', 0.000000, 300.000000, 36.23)), 6)
53
+ # cume_reach = round(float(st.sidebar.slider('cume reach', 0.000000, 300.000000, 36.231006)), 6)
54
 
55
+
56
  Share = round(float(st.sidebar.number_input('Share', 0.0, 100.0, 0.611246, step=0.000001)), 6)
57
  AMA = round(float(st.sidebar.number_input('AMA', 0.0, 45.0, 4.196084, step=0.000001)), 6)
58
  rate = round(float(st.sidebar.number_input('rate', 0.0, 1.5, 0.018516, step=0.000001)), 6)
59
+ daily_reach = round(float(st.sidebar.number_input('daily reach', 0.0, 300.0, 36.23, step=0.000001)), 6)
60
+ cume_reach = round(float(st.sidebar.number_input('cume reach', 0.0, 300.0, 36.231006, step=0.000001)), 6)
61
 
62
+
 
63
 
64
  # Share = st.sidebar.slider('Share', 0, 100, 0)
65
  # AMA = st.sidebar.slider('AMA', 0, 45, 4)
 
129
  # make the prediction using the loaded model and input data
130
  predicted_unrolled_value = model.predict(user_data)
131
 
132
+ # return the predict_unrolled_value as output
133
+ return predicted_unrolled_value[0]
134
 
135
 
136
  # Function calling
137
  y_pred = int(predict_unrolled_value(user_data))
138
+
139
+ # CSS code for changing color of the button
140
+ st.markdown("""
141
+ <style>
142
+ .stButton button {
143
+ background-color: #668f45;
144
+ color: white;
145
+ }
146
+ </style>
147
+ """, unsafe_allow_html=True)
148
+
149
+ # st.write("Click here to see the Predictions")
150
+ if st.button("Click here for Predictions"):
151
  st.subheader(f"Predicted Unrolled Value: {y_pred} ")