File size: 2,198 Bytes
397bba4
 
 
 
 
 
 
 
 
d63f613
397bba4
 
 
cb1f15f
 
397bba4
 
 
 
 
 
 
 
44efcd6
 
 
ad79b88
397bba4
 
03d548c
1889661
2f51e9c
 
 
 
 
1889661
 
397bba4
 
3b29dc9
397bba4
 
 
 
ad79b88
397bba4
 
3b29dc9
2593f36
44d0205
397bba4
ad79b88
397bba4
 
 
04a6574
 
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
50
51
52
53
54
55
56
57
58
59

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_Model_V1_0.joblib")

model = load_model()



# Streamlit UI for Price Prediction
st.title("SuperKart Revenue Prediction App")
st.write("This tool predicts the sales revenue listing based on the given details.")

st.subheader("Enter the listing details:")

# Collect user input
Product_Type = st.selectbox("Product_Type", ["Fruits and Vegetables ", "Snack Foods", "Frozen Foods","Dairy","Household","Baking Goods","Canned","Health and Hygiene","Meat","Soft Drinks","Breads","Hard Drinks","Others","Starchy Foods ","Breakfast","Seafood"])
Product_Weight = st.number_input("Product_Weight", min_value=0.0, value=12.66)
Product_MRP    = st.number_input("Product_MRP",min_value=0.0, value=100.0)
Product_Allocated_Area  = st.number_input("Product_Allocated_Area", min_value=0.0, value=100.0)
Product_Sugar_Content = st.selectbox("Product_Sugar_Content", ["Low Sugar", "No Sugar", "Regular", "reg"])
Store_Type = st.selectbox("Store_Type", ["Supermarket Type2 ", "Supermarket Type1","Departmental Store","Food Mart"])
Store_Location_City_Type = st.selectbox("Store_Location_City_Type", ["Tier 2", "Tier 1","Tier 3"])
Store_Id = st.selectbox("Store_Id",["OUT004","OUT003","OUT002","OUT001"])
Store_Establishment_Year = st.number_input(
    "Store_Establishment_Year",
    min_value=1900,
    max_value=2025,
    step=1,
    value=2000,
    format='%d'
)

# Convert user input into a DataFrame
input_data = pd.DataFrame([{
    'Product_Type': Product_Type,
    'Product_Weight': Product_Weight,
    'Product_MRP': Product_MRP,
    'Product_Allocated_Area': Product_Allocated_Area,
    'Product_Sugar_Content': Product_Sugar_Content,
    'Store_Type': Store_Type,
    'Store_Location_City_Type': Store_Location_City_Type,
    'Store_Id': Store_Id,
    'Store_Establishment_Year': Store_Establishment_Year,
}])


# Predict button
if st.button("Predict"):
    prediction = model.predict(input_data)
    #st.write(f"The predicted revnue is ${np.exp(prediction)[0]:.2f}.")
    st.write(f"The predicted revenue is ${prediction[0]:.2f}.")