| import pandas as pd |
| import requests |
| import streamlit as st |
|
|
| st.title('SuperKart Sales Revenue Prediction') |
|
|
| |
| Product_Weight = st.number_input('Product_Weight', value=15.78) |
| Product_Sugar_Content = st.selectbox('Product_Sugar_Content', ['No Sugar', 'Low Sugar', 'Regular'], index=0) |
| Product_Allocated_Area = st.number_input('Product_Allocated_Area', value=0.11) |
| Product_Type = st.selectbox('Product_Type', ['Household', 'Soft Drinks', 'Fruits and Vegetables', |
| 'Baking Goods', 'Meat', 'Dairy', 'Canned', 'Snack Foods', |
| 'Frozen Foods', 'Health and Hygiene', 'Breads', 'Hard Drinks', |
| 'Others', 'Starchy Foods', 'Breakfast', 'Seafood'], index=0) |
| Product_MRP = st.number_input('Product_MRP', value=172.83) |
| Store_Id = st.selectbox('Store_Id', ['OUT001', 'OUT002', 'OUT003', 'OUT004'], index=0) |
| Store_Establishment_Year = st.selectbox('Store_Establishment_Year',[1987,1998,1999,2009], index=0) |
| Store_Size = st.selectbox('Store_Size', ['Small', 'Medium', 'High'], index=0) |
| Store_Location_City_Type = st.selectbox('Store_Location_City_Type', ['Tier 1', 'Tier 2', 'Tier 3'], index=1) |
| Store_Type = st.selectbox('Store_Type', ['Supermarket Type1', 'Supermarket Type2', 'Departmental Store', 'Food Mart'], index=0) |
|
|
|
|
| |
| input_data = pd.DataFrame([{ |
| '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'): |
| response = requests.post( |
| 'https://neerajig-supermartrevenuepredictionbackend.hf.space/v1/superKartSales', |
| json=input_data.to_dict(orient='records')[0] |
| ) |
| if response.status_code == 200: |
| prediction = response.json() |
| st.success(f"Predicted Forecast/Revenue for Sale: {prediction['Sale']}") |
| else: |
| st.error(f"Error making Forecast/Revenue for Sale: {response.text}") |
|
|
|
|