PrecisionBallistics/SuperKart-Frontend
0
1 2import streamlit as st3import requests4 5st.title("SuperKart Sales Predictor") #Complete the code to define the title of the app.6 7# Input fields for product and store data8Product_Weight = st.number_input("Product Weight", min_value=0.0, value=12.66)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=0.0)11Product_MRP = st.number_input("Product_MRP", min_value=0.0, value=0.0)12Store_Size = st.selectbox("Store Size", ["High", "Medium", "Small"])13Store_Location_City_Type = st.selectbox("City Type", ["Tier 1", "Tier 2", "Tier 3"])14Store_Type = st.selectbox("Store Type", ["Supermarket Type1", "Supermarket Type2", "Supermarket Type3", "Grocery Store"])15Product_Id_char = st.selectbox("Product ID Category", ["FD", "DR", "NC"])16Store_Age_Years = st.number_input("Store Age (Years)", min_value=0, value=0)17Product_Type_Category = st.text_input("Product Category", value="Food")18 19product_data = {20 "Product_Weight": Product_Weight,21 "Product_Sugar_Content": Product_Sugar_Content,22 "Product_Allocated_Area": Product_Allocated_Area,23 "Product_MRP": Product_MRP,24 "Store_Size": Store_Size,25 "Store_Location_City_Type": Store_Location_City_Type,26 "Store_Type": Store_Type,27 "Product_Id_char": Product_Id_char,28 "Store_Age_Years": Store_Age_Years,29 "Product_Type_Category": Product_Type_Category30}31 32if st.button("Predict", type='primary'):33 response = requests.post("https://precisionballistics-superkart-backend.hf.space/v1/predict", json=product_data)34 35 if response.status_code == 200:36 result = response.json()37 predicted_sales = result["Sales"]38 st.write(f"Predicted Product Store Sales Total: ₹{predicted_sales:.2f}")39 else:40 st.error("Error in API request")41 