SuperKartSalesForecase / src /streamlit_app.py
prashant91's picture
Upload folder using huggingface_hub
084102c verified
import streamlit as st
import joblib
import pandas as pd
# Load the model
model = joblib.load("/app/src/best_sales_model.pkl")
st.title("SuperKart Store Sales Forecasting")
# Input form
st.subheader("Enter Product and Store Details")
product_weight = st.number_input("Product Weight", value=10.0)
sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])
allocated_area = st.slider("Product Allocated Area", 0.01, 1.0, 0.1)
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"])
product_mrp = st.number_input("Product MRP", value=100.0)
store_size = st.selectbox("Store Size", ["Small", "Medium", "High"])
store_city = st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
store_type = st.selectbox("Store Type", ["Supermarket Type2", "Supermarket Type1", "Departmental Store", "Food Mart"])
store_id = st.selectbox("Store ID", ["OUT001", "OUT002", "OUT003", "OUT004"])
store_age = st.slider("Store Age (Years)", 0, 50, 10)
# Predict
if st.button("Predict Sales"):
input_data = pd.DataFrame([{
'Product_Weight': product_weight,
'Product_Sugar_Content': sugar_content,
'Product_Allocated_Area': allocated_area,
'Product_Type': product_type,
'Product_MRP': product_mrp,
'Store_Size': store_size,
'Store_Location_City_Type': store_city,
'Store_Type': store_type,
'Store_Id': store_id,
'Store_Age': store_age
}])
prediction = model.predict(input_data)[0]
st.success(f"Predicted Sales: {round(prediction, 2)}")