File size: 1,810 Bytes
556b68d
 
 
 
af7992c
084102c
af7992c
556b68d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
af7992c
556b68d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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)}")