nsa9 commited on
Commit
960439c
·
verified ·
1 Parent(s): 9ea8963

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +25 -26
app.py CHANGED
@@ -16,35 +16,34 @@ st.write(
16
  st.subheader("Online Prediction (Single Product-Store Entry)")
17
 
18
  # Collect user input for product & store features
19
- product_weight = st.number_input("Product Weight (grams)", min_value=0.0, value=250.0, step=50.0)
20
- product_sugar_content = st.selectbox("Sugar Content", ["low sugar", "regular", "no sugar"])
21
- product_allocated_area = st.number_input("Allocated Display Area (ratio)", min_value=0.0, max_value=1.0, value=0.15)
22
- product_type = st.selectbox(
23
- "Product Type",
24
- ["meat", "snack foods", "hard drinks", "dairy", "canned", "soft drinks",
25
- "health and hygiene", "baking goods", "bread", "breakfast", "frozen foods",
26
- "fruits and vegetables", "household", "seafood", "starchy foods", "others"]
27
- )
28
- product_mrp = st.number_input("Maximum Retail Price (MRP)", min_value=1.0, value=50.0)
29
 
30
- store_id = st.text_input("Store ID (e.g., STR001)", value="STR001")
31
- store_est_year = st.number_input("Store Establishment Year", min_value=1900, max_value=2025, value=2010, step=1)
32
- store_size = st.selectbox("Store Size", ["high", "medium", "low"])
33
- store_location_city_type = st.selectbox("Store Location City Type", ["Tier 1", "Tier 2", "Tier 3"])
34
- store_type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type 1", "Supermarket Type 2", "Food Mart"])
35
 
36
- # Convert user input into a DataFrame (single row)
37
  input_data = pd.DataFrame([{
38
- 'Product_Weight': product_weight,
39
- 'Product_Sugar_Content': product_sugar_content,
40
- 'Product_Allocated_Area': product_allocated_area,
41
- 'Product_Type': product_type,
42
- 'Product_MRP': product_mrp,
43
- 'Store_Id': store_id,
44
- 'Store_Establishment_Year': store_est_year,
45
- 'Store_Size': store_size,
46
- 'Store_Location_City_Type': store_location_city_type,
47
- 'Store_Type': store_type
48
  }])
49
 
50
  # Make prediction when "Forecast Sales" is clicked
 
16
  st.subheader("Online Prediction (Single Product-Store Entry)")
17
 
18
  # Collect user input for product & store features
19
+ product_weight = st.number_input("Product Weight (kg)", min_value=4.0, max_value=22.0, value=12.65, step=0.1)
20
+ product_sugar_content = st.selectbox("Sugar Content", ["Low Sugar", "Regular", "No Sugar", "Non-edible"])
21
+ product_allocated_area = st.number_input("Allocated Area (ratio)", min_value=0.004, max_value=0.298, value=0.068, step=0.001)
22
+ product_type = st.selectbox("Product Type", [
23
+ "Fruits and Vegetables", "Snack Foods", "Dairy", "Canned", "Soft Drinks",
24
+ "Health and Hygiene", "Baking Goods", "Bread", "Breakfast", "Frozen Foods",
25
+ "Household", "Seafood", "Starchy Foods", "Meat", "Hard Drinks", "Others"
26
+ ])
27
+ product_mrp = st.number_input("Product MRP", min_value=31.0, max_value=266.0, value=147.0, step=1.0)
 
28
 
29
+ store_id = st.selectbox("Store ID", ["OUT001","OUT002","OUT003","OUT004"])
30
+ store_establishment_year = st.number_input("Store Establishment Year", min_value=1987, max_value=2025, value=2002, step=1)
31
+ store_size = st.selectbox("Store Size", ["High", "Medium", "Low"])
32
+ store_location_city_type = st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
33
+ store_type = st.selectbox("Store Type", ["Supermarket Type1", "Supermarket Type2", "Supermarket Type3", "Food Mart"])
34
 
35
+ # Input DataFrame with EXACT column names as training
36
  input_data = pd.DataFrame([{
37
+ "Product_Weight": product_weight,
38
+ "Product_Sugar_Content": product_sugar_content,
39
+ "Product_Allocated_Area": product_allocated_area,
40
+ "Product_Type": product_type,
41
+ "Product_MRP": product_mrp,
42
+ "Store_Id": "store_id",
43
+ "Store_Establishment_Year": store_establishment_year,
44
+ "Store_Size": store_size,
45
+ "Store_Location_City_Type": store_location_city_type,
46
+ "Store_Type": store_type
47
  }])
48
 
49
  # Make prediction when "Forecast Sales" is clicked