prashant91 commited on
Commit
f965862
·
verified ·
1 Parent(s): b3d44cb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +20 -40
app.py CHANGED
@@ -2,43 +2,24 @@ import streamlit as st
2
  import joblib
3
  import pandas as pd
4
 
5
- # Load the model
6
- @st.cache_resource
7
- def load_model():
8
- return joblib.load("best_sales_model.pkl")
9
-
10
- model = load_model()
11
-
12
- # App title
13
- st.set_page_config(page_title="SuperKart Sales Forecast", layout="centered")
14
- st.title("🛍️ SuperKart Stores Sales Forecasting")
15
-
16
- # User input form
17
- st.header("📋 Input Product & Store Details")
18
-
19
- with st.form("sales_form"):
20
- col1, col2 = st.columns(2)
21
-
22
- with col1:
23
- product_weight = st.number_input("Product Weight (in grams)", min_value=0.0, step=0.1)
24
- sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
25
- allocated_area = st.slider("Product Allocated Area (ratio)", min_value=0.0, max_value=1.0, step=0.01)
26
- product_type = st.selectbox("Product Type", [
27
- "Fruits and Vegetables", "Snack Foods", "Frozen Foods", "Dairy", "Household", "Baking Goods", "Canned", "Health and Hygiene", "Meat", "Soft Drinks", "Breads", "Hard Drinks", "Starchy Foods", "Breakfast", "Seafood", "Others"
28
- ])
29
- product_mrp = st.number_input("Product MRP", min_value=0, max_value=50, value=10)
30
-
31
- with col2:
32
- store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
33
- store_city = st.selectbox("Store Location City Type", ["Tier 1", "Tier 2", "Tier 3"])
34
- store_type = st.selectbox("Store Type", ["Supermarket Type2", "Supermarket Type1", "Departmental Store", "Food Mart"])
35
- store_id = st.selectbox("Store ID", ["OUT001", "OUT002", "OUT003", "OUT004"])
36
- store_age = st.slider("Store Age (Years)", min_value=0.1, value=100.0)
37
-
38
- submitted = st.form_submit_button("🔍 Predict Sales")
39
-
40
- # Predict sales
41
- if submitted:
42
  input_data = pd.DataFrame([{
43
  'Product_Weight': product_weight,
44
  'Product_Sugar_Content': sugar_content,
@@ -51,6 +32,5 @@ if submitted:
51
  'Store_Id': store_id,
52
  'Store_Age': store_age
53
  }])
54
-
55
- prediction = model.predict(input_data)[0]
56
- st.success(f"✅ Predicted Product Sales: ₹ {round(prediction, 2)}")
 
2
  import joblib
3
  import pandas as pd
4
 
5
+ st.title("SuperKart Store Sales Forecasting")
6
+
7
+ # Input form
8
+ st.subheader("Enter Product and Store Details")
9
+
10
+ product_weight = st.number_input("Product Weight", value=10.0)
11
+ sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
12
+ allocated_area = st.slider("Product Allocated Area", 0.01, 1.0, 0.1)
13
+ product_type = st.selectbox("Product Type", ["Fruits and Vegetables", "Snack Foods", "Frozen Foods", "Dairy", "Household", "Baking Goods", "Canned", "Health and Hygiene", "Meat", "Soft Drinks", "Breads", "Hard Drinks", "Starchy Foods", "Breakfast", "Seafood", "Others"])
14
+ product_mrp = st.number_input("Product MRP", value=100.0)
15
+ store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
16
+ store_city = st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
17
+ store_type = st.selectbox("Store Type", ["Supermarket Type2", "Supermarket Type1", "Departmental Store", "Food Mart"])
18
+ store_id = st.selectbox("Store ID", ["OUT001", "OUT002", "OUT003", "OUT004"])
19
+ store_age = st.slider("Store Age (Years)", 0, 50, 10)
20
+
21
+ # Predict
22
+ if st.button("Predict Sales"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  input_data = pd.DataFrame([{
24
  'Product_Weight': product_weight,
25
  'Product_Sugar_Content': sugar_content,
 
32
  'Store_Id': store_id,
33
  'Store_Age': store_age
34
  }])
35
+
36
+ st.success(f"Predicted Sales: {round(prediction, 2)}")