File size: 2,303 Bytes
9b610a7
 
 
5a85fab
05d6b03
9b610a7
5a85fab
05d6b03
 
5a85fab
b58adca
 
05d6b03
9b610a7
5a85fab
 
 
9b610a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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 = """
    <div style="background-color:tomato;padding:10px">
    <h2 style="color:white;text-align:center;">Streamlit Sales Predictor ML App </h2>
    </div>
    """
    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()