Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- app.py +41 -0
- best_sales_model.pkl +3 -0
- requirements.txt +11 -3
app.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import streamlit as st
|
| 3 |
+
import joblib
|
| 4 |
+
import pandas as pd
|
| 5 |
+
|
| 6 |
+
# Load the model
|
| 7 |
+
model = joblib.load("best_sales_model.pkl")
|
| 8 |
+
|
| 9 |
+
st.title("SuperKart Store Sales Forecasting")
|
| 10 |
+
|
| 11 |
+
# Input form
|
| 12 |
+
st.subheader("Enter Product and Store Details")
|
| 13 |
+
|
| 14 |
+
product_weight = st.number_input("Product Weight", value=10.0)
|
| 15 |
+
sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
|
| 16 |
+
allocated_area = st.slider("Product Allocated Area", 0.01, 1.0, 0.1)
|
| 17 |
+
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"])
|
| 18 |
+
product_mrp = st.number_input("Product MRP", value=100.0)
|
| 19 |
+
store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
|
| 20 |
+
store_city = st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
|
| 21 |
+
store_type = st.selectbox("Store Type", ["Supermarket Type2", "Supermarket Type1", "Departmental Store", "Food Mart"])
|
| 22 |
+
store_id = st.selectbox("Store ID", ["OUT001", "OUT002", "OUT003", "OUT004"])
|
| 23 |
+
store_age = st.slider("Store Age (Years)", 0, 50, 10)
|
| 24 |
+
|
| 25 |
+
# Predict
|
| 26 |
+
if st.button("Predict Sales"):
|
| 27 |
+
input_data = pd.DataFrame([{
|
| 28 |
+
'Product_Weight': product_weight,
|
| 29 |
+
'Product_Sugar_Content': sugar_content,
|
| 30 |
+
'Product_Allocated_Area': allocated_area,
|
| 31 |
+
'Product_Type': product_type,
|
| 32 |
+
'Product_MRP': product_mrp,
|
| 33 |
+
'Store_Size': store_size,
|
| 34 |
+
'Store_Location_City_Type': store_city,
|
| 35 |
+
'Store_Type': store_type,
|
| 36 |
+
'Store_Id': store_id,
|
| 37 |
+
'Store_Age': store_age
|
| 38 |
+
}])
|
| 39 |
+
|
| 40 |
+
prediction = model.predict(input_data)[0]
|
| 41 |
+
st.success(f"Predicted Sales: {round(prediction, 2)}")
|
best_sales_model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1e54bbb34d2ac12b359137b917fbcf267b4c191d7b05304baf174c7cf2b9eb25
|
| 3 |
+
size 63810675
|
requirements.txt
CHANGED
|
@@ -1,3 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
pandas==2.2.2
|
| 2 |
+
numpy==2.0.2
|
| 3 |
+
scikit-learn==1.6.1
|
| 4 |
+
xgboost==2.1.4
|
| 5 |
+
joblib==1.4.2
|
| 6 |
+
Werkzeug==2.2.2
|
| 7 |
+
flask==2.2.2
|
| 8 |
+
gunicorn==20.1.0
|
| 9 |
+
requests==2.28.1
|
| 10 |
+
uvicorn[standard]
|
| 11 |
+
streamlit==1.43.2
|