import streamlit as st import pandas as pd import joblib import numpy as np # Load the trained model @st.cache_resource def load_model(): return joblib.load("super_kart_prediction_model_v1_0.joblib") model = load_model() # Streamlit UI for Price Prediction st.title("Super Kart Product total sales Prediction App") st.write("This tool predicts the total sales of the provided product.") st.subheader("Enter the listing details:") # Collect user input Product_Id = st.text_input("Product Id") Product_Weight = st.number_input("weight of each product", min_value=0.001, max_value=1000.00) Product_Sugar_Content = st.selectbox("Product Sugar Content Level", ["Low Sugar", "Regular", "No Sugar", "reg"]) Product_Allocated_Area = st.number_input("Product allocated display area(ratio to total product display area)", min_value=0.001, max_value=1.0) 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", "Others", "Starchy Foods", "Breakfast", "Seafood"]) Product_MRP = st.number_input("Maximum retail price of the product", min_value=1.00, max_value=10000.00) Store_Establishment_Year = st.number_input("Year in which the store was established", min_value=1800, max_value=2025) Store_Size = st.selectbox("Relative size of the store", ["Medium", "High", "Small"]) Store_Location_City_Type = st.selectbox("Type of city in which the store is located", ["Tier 1", "Tier 2", "Tier 3"]) Store_Type = st.selectbox("Store Type", ["Supermarket Type1", "Supermarket Type2", "Departmental Store", "Food Mart"]) # Convert user input into a DataFrame input_data = pd.DataFrame([{ 'Product_Id': Product_Id, '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_Establishment_Year': Store_Establishment_Year, 'Store_Size': Store_Size, 'Store_Location_City_Type': Store_Location_City_Type, 'Store_Type': Store_Type }]) # Predict button if st.button("Predict"): prediction = model.predict(input_data) st.write(f"The predicted total sales for the provided product is ${prediction[0]:.2f}.")