| import streamlit as st |
| import pandas as pd |
| import requests |
|
|
| |
| st.title("SuperKart Product store Revenue Prediction App") |
| st.write("This app forecast the sales revenue of its outlets for various products.") |
| st.write("Fill in the required inputs below and get a prediction.") |
|
|
| Product_type_values = ["Frozen Foods", "Dairy", "Canned", "Baking Goods","Health and Hygiene", "Snack Foods", "Meat", "Household","Hard Drinks", "Fruits and Vegetables", "Breads", "Soft Drinks", "Breakfast", "Others", "Starchy Foods", "Seafood"] |
| sorted_options = sorted(Product_type_values) |
|
|
| |
| Product_Weight= st.number_input("Please enter the Product Weight", min_value=0.0, value=0.0) |
| Product_Sugar_Content= st.selectbox('Please select Product Sugar Content',["Please select","Low Sugar","No Sugar","Regular","reg"], index=1) |
| Product_Allocated_Area= st.number_input("Please enter the amount of area to be allocated for the product", min_value=0.0, value=0.0) |
| Product_Type= st.selectbox("Please select product Type",sorted_options) |
| Product_MRP= st.number_input("Please enter the Product MRP", min_value=0.0, value=0.0) |
|
|
| |
| |
| |
| |
| |
|
|
| Store_Id= st.selectbox("Please select store",["OUT001","OUT002","OUT003","OUT004"]) |
| Store_Establishment_Year= st.selectbox("Store Establishment Year",[1987, 1998, 1999, 2009]) |
| Store_Size= st.selectbox("Store size ", ["High","Medium","Small"]) |
| Store_Location_City_Type= st.selectbox("Store location City type ", ["Tier 1","Tier 2","Tier 3"]) |
| Store_Type= st.selectbox("Store Type ", ["Supermarket Type2", "Supermarket Type1","Food Mart", "Departmental Store"]) |
|
|
|
|
| |
| input_data = { |
| 'Product_Weight': Product_Weight, |
| 'Product_Sugar_Content': Product_Sugar_Content, |
| 'Product_Allocated_Area': Product_Allocated_Area, |
| 'Product_Type': Product_Type, |
| 'Product_MRP': Product_MRP, |
| 'Store_Id': Store_Id, |
| 'Store_Establishment_Year': Store_Establishment_Year, |
| 'Store_Size': Store_Size, |
| 'Store_Location_City_Type': Store_Location_City_Type, |
| 'Store_Type': Store_Type |
| } |
|
|
| if st.button("Predict", type='primary'): |
| response = requests.post("https://Shaggys86-SuperKartProductSalesPrediction.hf.space/v1/product", json=input_data) |
| if response.status_code == 200: |
| result = response.json() |
| predicted_sales = result["Predicted_Product_store_Sales"] |
| st.success(f"The Predicted Product Store Sales Value: {predicted_sales}") |
| else: |
| st.error("Error in API request") |
|
|