| import streamlit as st |
| import pandas as pd |
| import requests |
|
|
| |
| st.title("SuperKart Sales Revenue Prediction") |
|
|
| |
| st.subheader("Online Prediction") |
|
|
| |
| store_id = st.selectbox("Store Id", ["OUT001", "OUT002", "OUT003","OUT004"]) |
| product_type = st.selectbox("Product Type", ["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"]) |
| product_sugar_content = st.selectbox("Sugar Contents", ["Low Sugar","Regular","No Sugar","reg"]) |
| product_mrp = st.number_input("MPR", min_value=1.0, max_value=500.0, step=1.0, value=90.0) |
| product_weight = st.number_input("Product Weight", min_value=1.0, max_value=30.0, step=1.0, value=5.0) |
| product_allocated_area = st.number_input("Allocated Display Area Ratio", min_value=0.001, max_value=0.3, step=0.001, value=0.10) |
|
|
|
|
| |
| input_data = { |
| 'store_id': store_id, |
| 'product_type': product_type, |
| 'product_sugar_content': product_sugar_content, |
| 'product_mrp': product_mrp, |
| 'product_weight': product_weight, |
| 'product_allocated_area': product_allocated_area |
| } |
|
|
| |
| if st.button("Predict"): |
| response = requests.post("https://SRGL-SuperKartSalesRevenuePredictorBackend.hf.space/v1/sales", json=input_data) |
| if response.status_code == 200: |
| prediction = response.json()['Predicted Sales Revenue'] |
| st.success(f"Predicted Sales Revenue: {prediction}") |
| else: |
| st.error("Error making prediction.") |
| st.error(input_data) |
|
|