CoolFace
Apppublic

Cacti0102/FinalProject-Frontend

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
app.py40 linesDownload Raw Back to root
1 2import streamlit as st3import requests4 5st.title("SuperKart") #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.068) # Complete the code to define the UI element for Product_Allocated_Area11Product_MRP = st.number_input("Product MRP", min_value=0.0, value=147.03) # Complete the code to define the UI element for Product_MRP12Store_Size = st.selectbox("Store Size", ["Medium", "High", "Small"]) # Complete the code to define the UI element for Store_Size13Store_Location_City_Type = st.selectbox("Store Location City Type", ["Tier 2", "Tier 1", "Tier 3"]) # Complete the code to define the UI element for Store_Location_City_Type14Store_Type = st.selectbox("Store Type", ["Supermarket Type2", "Departmental Store", "Supermarket Type1", "Food Mart"]) # Complete the code to define the UI element for Store_Type15Product_Id_char = st.selectbox("Product ID Character", ["FD", "NC", "DR"]) # Complete the code to define the UI element for Product_Id_char16Store_Age_Years = st.number_input("Store Age (Years)", min_value=0, value=20) # Complete the code to define the UI element for Store_Age_Years17Product_Type_Category = st.selectbox("Product Type Category", ["Perishables", "Non Perishables"]) # Complete the code to define the UI element for Product_Type_Category18 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://Cacti0102-FinalProject.hf.space/v1/predict", json=product_data)    # Complete the code to enter user name and space name to correctly define the endpoint34    if response.status_code == 200:35        result = response.json()36        predicted_sales = result["Sales"]37        st.write(f"Predicted Product Store Sales Total: {predicted_sales:.2f}")38    else:39        st.error("Error in API request")40