|
|
|
|
|
import streamlit as st |
|
|
import pandas as pd |
|
|
import joblib |
|
|
import numpy as np |
|
|
|
|
|
|
|
|
@st.cache_resource |
|
|
def load_model(): |
|
|
return joblib.load("store_total_sales_prediction_model_v1_0.joblib") |
|
|
|
|
|
model = load_model() |
|
|
|
|
|
|
|
|
st.title("Store Total Sales Prediction App") |
|
|
st.write("This tool predicts the total sales of a store based on the given store and its product details.") |
|
|
|
|
|
st.subheader("Enter the listing details:") |
|
|
|
|
|
|
|
|
product_weight = st.number_input("Product Weight", min_value=4.0, max_value=22.0, step=0.1, value=5.0) |
|
|
product_sugar_content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar", "reg"]) |
|
|
product_allocated_area = st.number_input("Product Allocated Area", min_value=0.004, max_value=0.298000, step=0.1, value=0.01) |
|
|
product_type = st.selectbox("Product Type", ["Frozen Foods", "Dairy", "Canned", "Baking Goods", "Health and Hygiene", |
|
|
"Snack Foods", "Meat", "Household", "Hard Drinks", "Fruits and Vegetables", |
|
|
"Breads", "Soft Drinks", "Breakfast", "Others", "Starchy Foods", "Seafood"]) |
|
|
product_mrp = st.number_input("Product MRP", min_value=31.0, max_value=266.0, step=5.0, value=50.0) |
|
|
store_id = st.selectbox("Store Id ", ["OUT001", "OUT002", "OUT003", "OUT004"]) |
|
|
store_establishment_year = st.selectbox("Store Establishment Year ", ["1987", "1998", "1999", "2009"]) |
|
|
store_size = st.selectbox("Store Size ", ["Small", "Medium", "High"]) |
|
|
store_location_city_type = st.selectbox("Store Location City Type ", ["Tier 1", "Tier 2", "Tier 3"]) |
|
|
store_type = st.selectbox("Store Type ", ["Supermarket Type1", "Supermarket Type2", "Departmental Store", "Food Mart"]) |
|
|
|
|
|
|
|
|
input_data = pd.DataFrame([{ |
|
|
'Product_Weight': product_weight, |
|
|
'Product_Sugar_Content': product_sugar_content, |
|
|
'Product_Allocated_Area': product_allocated_area, |
|
|
'Product_Type': product_type, |
|
|
'Product_MRP': product_mrp, |
|
|
'Store_Id': store_id, |
|
|
'Store_Establishment_Year': store_establishment_year, |
|
|
'Store_Size': store_size, |
|
|
'Store_Location_City_Type': store_location_city_type, |
|
|
'Store_Type': store_type |
|
|
}]) |
|
|
|
|
|
|
|
|
|
|
|
if st.button("Predict"): |
|
|
prediction = model.predict(input_data) |
|
|
st.write(f"The predicted total sales of the store is: {prediction}") |
|
|
|