mrashida/Sales-Prediction
0
1 2import streamlit as st3import requests4 5st.title("SuperKart Sales Forecast")6 7# Input fields for product and store data8Product_Weight = st.number_input("Product Weight", min_value=0.0, value=22.0)9Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar"])10Product_Allocated_Area = st.number_input("Product Allocated Area", min_value=0.0, value=1.0)11Product_Type = st.selectbox("Product Type", ["Meat", "Canned", "Baking Goods", "Snack Foods", "Dairy", "Fruits and Vegetables", "Soft Drinks", "Seafood", "Household", "Others", "Health and Hygiene", "Frozen Foods", "Hard Drinks", "Starchy Foods", "Breads", "Breakfast"])12Product_MRP = st.number_input("Product MRP", min_value=31.0, value=266.0)13Store_Size = st.selectbox("Store Size", ["Small", "Medium", "Large"])14Store_Location_City_Type = st.selectbox("Store Location City Type", ["Tier 1", "Tier 2", "Tier 3"])15Store_Type = st.selectbox("Store Type", ["FoodMart", "Departmental Store", "Supermarket Type1", "Supermarket Type2"])16 17product_data = {18 "Product_Weight": Product_Weight,19 "Product_Sugar_Content": Product_Sugar_Content,20 "Product_Allocated_Area": Product_Allocated_Area,21 "Product_Type": Product_Type,22 "Product_MRP": Product_MRP,23 "Store_Size": Store_Size,24 "Store_Location_City_Type": Store_Location_City_Type,25 "Store_Type": Store_Type,26}27 28if st.button("Predict", type='primary'):29 response = requests.post("https://mrashida-SuparKartSale-api.hf.space/v1/predict", json=product_data) # user name and space name to define the endpoint30 if response.status_code == 200:31 result = response.json()32 predicted_sales = result["Sales"]33 st.write(f"Predicted Product Store Sales Total: ₹{predicted_sales:.2f}")34 else:35 st.error("Error in API request")36 