Spaces:
No application file
No application file
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| import numpy as np | |
| # Load the trained model | |
| def load_model(): | |
| return joblib.load("superkart_price_prediction_model_v1_0.joblib") | |
| model = load_model() | |
| # Streamlit UI for Price Prediction | |
| st.title("SuperKart Rental Price Prediction App") | |
| st.write("This tool predicts the price of an Superkart total sales based on the property type.") | |
| st.subheader("Enter the listing details:") | |
| # Collect user input | |
| product_Weight=st.number_input("Product_Weight", min_value=1, value=30.00) | |
| product_Sugar_Content=st.selectbox("Product Sugar Content", ["Low Sugar", "No Sugar", "Regular"]) | |
| product_Allocated_Area=st.number_input("Product Allocate Area", min_value=0.001, value=0.09) | |
| product_Type=st.selectbox("Product Type", ["meat", "snack foods", "hard drinks", "dairy", "canned", "soft drinks", "health and hygiene", "baking goods", "bread", "breakfast", "frozen foods", "fruits and vegetables", "household", "seafood", "starchy foods", "others"]) | |
| product_MRP=st.number_input("Product MRP", min_value=1, value=30.00) | |
| store_Id=st.selectbox("Store ID", ["OUT001", "OUT002", "OUT003", "OUT004"]) | |
| store_Establishment_Year=st.number_input("Store Establishment year", min_value=1987, value=2009) | |
| store_Size=st.selectbox("Store Size", ["High", "Medium", "Small"]) | |
| store_Location_City_Type=st.selectbox("Store location City", ["Tier1", "Tier2", "Tier3"]) | |
| store_Type=st.selectbox("Store Type", ["Departmental Store", "Supermarket Type 1", "Supermarket Type 2", "Food Mart"]) | |
| # Convert user input into a DataFrame | |
| 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 | |
| }]) | |
| # Predict button | |
| if st.button("Predict"): | |
| prediction = model.predict(input_data) | |
| st.write(f"The predicted price of the superkart sales is ${np.exp(prediction)[0]:.2f}.") |