File size: 1,953 Bytes
9e0535a
 
 
 
 
 
 
 
 
5ec898a
9e0535a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

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

model = load_model()

# Streamlit UI for Price Prediction
st.title("Super Kart Forecasting App")
st.write("This tool predicts the Sales Strategies")

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

# Collect user input
product_weight = st.number_input("Weight", min_value=1, step=1, value=2)
Product_Sugar_Content = st.selectbox("Sugar", ["Low", "Regular", "No"])
Product_Allocated_Area = st.number_input("Area", min_value=1, step=1, value=2)
Product_Type = st.selectbox("Product type", ["meat", "snack foods", "hard drinks", "dairy", "canned", "soft drinks", "health","hygiene", "baking goods", "bread", "breakfast", "frozen foods", "fruits","vegetables", "household", "seafood", "starchy foods", "others"])
Product_MRP = st.number_input("MRP", min_value=1, step=1, value=2)
Store_Establishment_Year = st.number_input("year", min_value=1950, step=1, value=2)
Store_Size = st.selectbox("Store Size", ["High", "Medium", "Low"])
Store_Location_City_Type =  st.selectbox("Store City Type", ["Tier 1", "Tier 2", "Tier 3"])
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_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 value ${np.exp(prediction)[0]:.2f}.")