import streamlit as st import requests import pandas as pd # Streamlit UI for Super Kart Store Sales Prediction st.title("Super Kart Store Sales Predictor Application") st.write("This tool predicts Store Sales based on store details. Enter the required information below.") # Collect user input based on dataset columns Product_Weight = st.number_input("Product Weight", min_value=1.0, value=10.0) Product_Allocated_Area= st.number_input("Product Allocated Area", min_value=0.0, value=0.05) Product_MRP= st.number_input("Product MRP", min_value=0.0, value=0.05) Store_Establishment_Year = st.number_input("Store Establishment Year", min_value=1987, max_value=2025) Product_Sugar_Content = st.selectbox("Product Sugar Content", ["No Sugar", "Low Sugar", "Regular"]) 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"]) Store_Id = st.selectbox("Store Id", ["OUT001", "OUT002", "OUT003", "OUT004"]) 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"]) # Convert categorical inputs to match model training store_data = { "Product_Weight": Product_Weight, "Product_Allocated_Area": Product_Allocated_Area, "Product_MRP": Product_MRP, "Store_Establishment_Year": Store_Establishment_Year, "Product_Sugar_Content": Product_Sugar_Content, "Product_Type": Product_Type, "Store_Id":Store_Id, "Store_Location_City_Type": Store_Location_City_Type, "Store_Type": Store_Type, "Store_Size": Store_Size } if st.button("Predict", type='primary'): response = requests.post("https://supravab-supbskartbackend.hf.space/v1/predict", json=store_data) # enter user name and space name before running the cell if response.status_code == 200: result = response.json() sales_prediction = result["predicted store sales total"] # Extract only the value st.write(f"Based on the information provided, the store sales is likely to {sales_prediction}.") else: st.error(f"Error in Super Kart API request: {response.status_code} - {response.text}")