File size: 2,198 Bytes
eede90e
129284f
eede90e
 
67cbc8c
129284f
eede90e
 
 
 
 
 
 
 
 
 
 
67cbc8c
eede90e
 
 
 
 
 
 
 
 
 
 
67cbc8c
 
eede90e
 
 
 
 
 
 
 
 
 
 
 
 
67cbc8c
eede90e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
import pandas as pd
import joblib
import numpy as np

# Load the trained model
@st.cache_resource
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}.")