RomMat's picture
Upload folder using huggingface_hub
5f7baad verified
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("Product_Store_Sales_Total_Prediction_model_v1_0.joblib")
model = load_model()
# Streamlit UI for Price Prediction
st.title("SuperKart Product Store Sales Total Prediction App")
st.write("This tool predict the sales total of a SuperKart store based on product details.")
st.subheader("Enter the product details")
# Collect the products input
store_id = st.text_input("Store_Id")
store_establishment_year = st.text_input("Store_Establishment_Year (in years)")
store_size = st.text_input("Store_Size")
store_location_city_type = st.text_input("Store_Location_City_Type")
store_type = st.text_input("Store_Type")
product_sugar_content = st.text_input("Product_Sugar_Content")
product_type = st.text_input("Product_Type")
product_weight = st.text_input("Product_Weight")
product_allocated_area = st.text_input("Product_Allocated_Area")
product_mrp = st.text_input("Product_MRP")
# Convert user input into a DataFrame
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" # Placeholder for Product_Id as it's not user input in this UI
}])
# Predict button
if st.button("Predict"):
# Make prediction when the "predict" button is clicked
prediction = model.predict(input_data)
st.write(f"Predicted product store sales total (in dollars): {prediction[0]}")