| import streamlit as st |
| import pandas as pd |
| import requests |
|
|
| |
| st.title('SuperKart Product Store Sales Total Prediction') |
| st.write("This tool predicts store sales based on their products details") |
|
|
| |
| st.subheader('Online Prediction') |
|
|
| |
| store_id = st.text_input('Store ID') |
| store_establishment_year = st.number_input('Store Establishment Year') |
| store_size = st.selectbox('Store Size', ['Small', 'Medium', 'High']) |
| store_location_city_type = st.selectbox('Store Location City Type', ['Tier 1', 'Tier 2', 'Tier 3']) |
| store_type = st.selectbox('Store Type', ['Supermarket Type1', 'Supermarket Type2', 'Supermarket Type3']) |
| product_sugar_content = st.selectbox('Product Sugar Content', ['Low Sugar', 'Regular', 'No Sugar']) |
| product_type = st.selectbox('Product Type', ['Perishables', 'Non Perishables']) |
| product_weight = st.number_input('Product Weight') |
| product_allocated_area = st.number_input('Product Allocated Area') |
| product_mrp = st.number_input('Product MRP') |
|
|
| |
| |
| |
| |
|
|
| |
| |
| input_data = pd.DataFrame([{ |
| "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, |
| "Product_Sugar_Content": product_sugar_content, |
| "Product_Type": product_type, |
| "Product_Weight": product_weight, |
| "Product_Allocated_Area": product_allocated_area, |
| "Product_MRP": product_mrp, |
| "Product_Id": "FD6114" |
| }]) |
|
|
| |
| if st.button('Predict'): |
| |
| |
| response = requests.post("https://rommat/storesalestotalpredictionbackend.hf.space/v1/productstoresalestotal", json=input_data.to_dict(orient='records')[0]) |
| if response.status_code == 200: |
| prediction = response.json()['Predicted Product Store Sales Total (in dollars)'] |
| st.success(f'Predicted Product Store Sales Total Price (in dollars): {prediction}') |
| else: |
| st.error(f'Error making prediction. Status code: {response.status_code}') |
|
|