import numpy as np
import pandas as pd
import streamlit as st
import joblib
#import datasets
#pickle_in = open("./Regressor.pkl","rb")
#pickle_in = "pracheeeeez/Sales_Prediction/Regressor.pkl"
# Regressor=pickle.load(pickle_in)
#pickle_in = open("C:\Users\PRACHI\OneDrive\Documents\ML\Regressor.pkl","rb")
#Regressor = datasets.load_from_disk(f"spaces://{pickle_in}")
Regressor = joblib.load("Regressor.pkl")
def predict_sales(Item_Identifier,Item_Weight, Item_Fat_Content,Item_Visibility,Item_Type,Item_MRP,Outlet_Identifier,Outlet_Establishment_Year,Outlet_Size,Outlet_Location_Type,Outlet_Type):
prediction= Regressor.predict([[Item_Identifier,Item_Weight, Item_Fat_Content,Item_Visibility,Item_Type,Item_MRP,Outlet_Identifier,Outlet_Establishment_Year,Outlet_Size,Outlet_Location_Type,Outlet_Type]])
print(prediction)
return prediction
def main():
st.title("Mart Sales Predictor")
html_temp = """
Streamlit Sales Predictor ML App
"""
st.markdown(html_temp,unsafe_allow_html=True)
Item_Identifier = st.text_input("Item_Identifier","Type Here")
Item_Weight = st.text_input("Item_Weight","Type Here")
Item_Fat_Content = st.text_input("Item_Fat_Content","Type Here")
Item_Visibility = st.text_input("Item_Visibility","Type Here")
Item_Type = st.text_input("Item_Type","Type Here")
Item_MRP = st.text_input("Item_MRP","Type Here")
Outlet_Identifier = st.text_input("Outlet_Identifier","Type Here")
Outlet_Establishment_Year = st.text_input("Outlet_Establishment_Year","Type Here")
Outlet_Size = st.text_input("Outlet_Size","Type Here")
Outlet_Location_Type = st.text_input("Outlet_Location_Type","Type Here")
Outlet_Type = st.text_input("Outlet_Type","Type Here")
result=""
if st.button("Predict"):
result=predict_sales(Item_Identifier,Item_Weight, Item_Fat_Content,Item_Visibility,Item_Type,Item_MRP,Outlet_Identifier,Outlet_Establishment_Year,Outlet_Size,Outlet_Location_Type,Outlet_Type)
st.success('The output is {}'.format(result))
if st.button("About"):
st.text("Lets LEarn")
st.text("Built with Streamlit")
if __name__=='__main__':
main()