CoolFace
Apppublic

Armando7pr/SuperKartFrontend

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
app.py48 linesDownload Raw Back to root
1 2import streamlit as st3import requests4 5st.title("SuperKart Sales Prediction Model") #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 (Ratio)", min_value=0.0, max_value=1.0, value=0.25, step=0.01)11Product_MRP = st.number_input("Product MRP", min_value=0.0, value=120.00, step=0.5)12Store_Size = st.selectbox("Store Size", ["Low", "Medium", "High"])13Store_Location_City_Type = st.selectbox("Store Location City Type", ["Tier 1", "Tier 2", "Tier 3"])14Store_Type = st.selectbox("Store Type", ["Departmental Store", "Supermarket Type 1", "Supermarket Type 2", "Food Mart"])15Product_Id_char = st.text_input("Product ID (e.g., FD12)", value="FD12")16Store_Age_Years = st.number_input("Store Age (Years)", min_value=0, max_value=100, value=10, step=1)17Product_Type_Category = st.selectbox(18    "Product Type Category",19    [20        "Meat", "Snack Foods", "Hard Drinks", "Dairy", "Canned", "Soft Drinks",21        "Health and Hygiene", "Baking Goods", "Bread", "Breakfast",22        "Frozen Foods", "Fruits and Vegetables", "Household",23        "Seafood", "Starchy Foods", "Others"24    ]25)26 27product_data = {28    "Product_Weight": Product_Weight,29    "Product_Sugar_Content": Product_Sugar_Content,30    "Product_Allocated_Area": Product_Allocated_Area,31    "Product_MRP": Product_MRP,32    "Store_Size": Store_Size,33    "Store_Location_City_Type": Store_Location_City_Type,34    "Store_Type": Store_Type,35    "Product_Id_char": Product_Id_char,36    "Store_Age_Years": Store_Age_Years,37    "Product_Type_Category": Product_Type_Category38}39 40if st.button("Predict", type='primary'):41    response = requests.post("https://Armando7pr/SuperKart-Sales-Prediction-Model.hf.space/v1/predict", json=product_data)    # Complete the code to enter user name and space name to correctly define the endpoint42    if response.status_code == 200:43        result = response.json()44        predicted_sales = result["Sales"]45        st.write(f"Predicted Product Store Sales Total: ₹{predicted_sales:.2f}")46    else:47        st.error("Error in API request")48