| import streamlit as st |
| import pandas as pd |
| import requests |
|
|
| |
| st.title("Super Kart Sales Prediction Application") |
| st.write("This tool predicts sales Enter the required information below.") |
|
|
| |
| Product_Weight = st.number_input("Product Weight", min_value=0.0, value=10.0) |
| Product_Sugar_Content = st.selectbox("Product Sugar Content", ["Low Sugar", "Regular", "No Sugar", "reg"]) |
| Product_Allocated_Area = st.number_input("Product Allocated Area", min_value=0.0, value=0.1) |
| Product_MRP = st.number_input("Product MRP", min_value=0.0, value=100.0) |
| Store_Size = st.selectbox("Store Size", ["Medium", "High", "Small"]) |
| Store_Location_City_Type = st.selectbox("Store Location City Type", ["Tier 2", "Tier 1", "Tier 3"]) |
| Store_Type = st.selectbox("Store Type", ["Supermarket Type2", "Departmental Store", "Supermarket Type1", "Food Mart"]) |
| Pcategory = st.selectbox("Product Category", ["FD", "NC", "DR"]) |
| Product_Type_category = st.selectbox("Product Type Category", ["Perishable", "Non-Perishable"]) |
| |
|
|
| product_info = { |
| "Product_Weight": Product_Weight, |
| "Product_Sugar_Content": str(Product_Sugar_Content), |
| "Product_Allocated_Area": Product_Allocated_Area, |
| "Product_MRP": Product_MRP, |
| "Store_Size": str(Store_Size), |
| "Store_Location_City_Type": str(Store_Location_City_Type), |
| "Store_Type": str(Store_Type), |
| 'category': str(Pcategory), |
| 'Product_Type_category': str(Product_Type_category) |
| |
|
|
| } |
| if st.button("Predict", type='primary'): |
| response = requests.post("https://KoulVivek-GL-Retail-Sales-Prediction.hf.space/v1/sales", json=product_info) |
| if response.status_code == 200: |
| result = response.json() |
| prediction = result["Sales"] |
| st.write(f"Based on the information provided, the Product sales is {prediction}.") |
| else: |
| st.error("Error in API request") |
|
|