Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,22 +40,24 @@ elif selection == "EDA":
|
|
40 |
elif selection == "Make a Prediction":
|
41 |
st.title("Make a Sales Prediction")
|
42 |
with st.form("input_form"):
|
|
|
43 |
# Capture all inputs as per the original dataset
|
44 |
order_date = st.date_input('Order Date', datetime.now())
|
45 |
-
ship_date = st.date_input('Ship Date', datetime.now())
|
46 |
-
ship_mode = st.selectbox('Ship Mode', ['First Class', 'Second Class', 'Standard Class', 'Same Day'])
|
47 |
-
segment = st.selectbox('Segment', ['Consumer', 'Corporate', 'Home Office'])
|
48 |
country = st.text_input('Country', value='United States')
|
49 |
-
city = st.text_input('City')
|
50 |
-
state = st.text_input('State')
|
51 |
-
postal_code = st.text_input('Postal Code')
|
52 |
-
region = st.selectbox('Region', ['South', 'West', 'Central', 'East'])
|
53 |
-
category = st.selectbox('Category', ['Furniture', 'Office Supplies', 'Technology'])
|
54 |
-
sub_category = st.selectbox('Sub-Category', ['Bookcases', 'Chairs', 'Labels', 'Tables', 'Storage', 'Furnishings', 'Art', 'Phones', 'Binders', 'Appliances', 'Paper', 'Accessories', 'Envelopes', 'Fasteners', 'Supplies', 'Machines', 'Copiers'])
|
55 |
-
product_name = st.text_input('Product Name')
|
56 |
-
sales = st.number_input('Sales', value=
|
57 |
-
quantity = st.number_input('Quantity', value=
|
58 |
-
discount = st.number_input('Discount', value=0.0, format="%.2f")
|
|
|
59 |
|
60 |
submit_button = st.form_submit_button("Predict")
|
61 |
|
@@ -63,7 +65,7 @@ elif selection == "Make a Prediction":
|
|
63 |
# Construct the input DataFrame
|
64 |
input_features = pd.DataFrame([[sub_category, sales, quantity, discount
|
65 |
]], columns=[
|
66 |
-
'Sub-Category', 'Sales', 'Quantity', 'Discount'
|
67 |
])
|
68 |
|
69 |
# Preprocess and predict (You'll need to adjust this part based on how your model expects input)
|
|
|
40 |
elif selection == "Make a Prediction":
|
41 |
st.title("Make a Sales Prediction")
|
42 |
with st.form("input_form"):
|
43 |
+
|
44 |
# Capture all inputs as per the original dataset
|
45 |
order_date = st.date_input('Order Date', datetime.now())
|
46 |
+
ship_date = st.date_input('Ship Date', datetime.now() + timedelta(days=1)) # Assume shipping the next day
|
47 |
+
ship_mode = st.selectbox('Ship Mode', ['First Class', 'Second Class', 'Standard Class', 'Same Day'], index=2) # Default to Standard Class
|
48 |
+
segment = st.selectbox('Segment', ['Consumer', 'Corporate', 'Home Office'], index=0) # Default to Consumer
|
49 |
country = st.text_input('Country', value='United States')
|
50 |
+
city = st.text_input('City', value='Los Angeles') # Example city
|
51 |
+
state = st.text_input('State', value='California') # Example state
|
52 |
+
postal_code = st.text_input('Postal Code', value='90001') # Example postal code
|
53 |
+
region = st.selectbox('Region', ['South', 'West', 'Central', 'East'], index=1) # Default to West
|
54 |
+
category = st.selectbox('Category', ['Furniture', 'Office Supplies', 'Technology'], index=1) # Default to Office Supplies
|
55 |
+
sub_category = st.selectbox('Sub-Category', ['Bookcases', 'Chairs', 'Labels', 'Tables', 'Storage', 'Furnishings', 'Art', 'Phones', 'Binders', 'Appliances', 'Paper', 'Accessories', 'Envelopes', 'Fasteners', 'Supplies', 'Machines', 'Copiers'], index=10) # Default to Paper
|
56 |
+
product_name = st.text_input('Product Name', value='Staple papers') # Example product
|
57 |
+
sales = st.number_input('Sales', value=100.0, format="%.2f") # Example sales amount
|
58 |
+
quantity = st.number_input('Quantity', value=2, format="%d") # Example quantity
|
59 |
+
discount = st.number_input('Discount', value=0.0, format="%.2f") # Example discount
|
60 |
+
|
61 |
|
62 |
submit_button = st.form_submit_button("Predict")
|
63 |
|
|
|
65 |
# Construct the input DataFrame
|
66 |
input_features = pd.DataFrame([[sub_category, sales, quantity, discount
|
67 |
]], columns=[
|
68 |
+
'Sub-Category', 'Product Name', 'Sales', 'Quantity', 'Discount'
|
69 |
])
|
70 |
|
71 |
# Preprocess and predict (You'll need to adjust this part based on how your model expects input)
|