|
import streamlit as st |
|
import numpy as np |
|
import pandas as pd |
|
import joblib |
|
from datetime import date |
|
from prophet.plot import plot_plotly, plot_components |
|
|
|
|
|
|
|
model= joblib.load("models/fbpmodel.joblib") |
|
|
|
|
|
|
|
test=pd.read_csv("dataframes/test.csv") |
|
|
|
test=test.drop(["holiday", "locale", "transferred"], axis= 1) |
|
|
|
result= model.predict(test) |
|
|
|
|
|
|
|
st.set_page_config(page_title="Favorita Stores Sales Prediction App",layout="centered") |
|
|
|
|
|
|
|
st.image("hour_glass_2.jpg") |
|
|
|
|
|
st.title("Favorita Store Sales Prediction APP with Facebook Prophet") |
|
|
|
st.markdown("Welcome to the sales prediction app for Favorita stores!") |
|
|
|
df_ori= pd.read_csv("dataframes/original_dataframe.csv") |
|
df_ori= df_ori.set_index("date") |
|
st.subheader("A Chart of the Daily Sales Across Favorita Stores") |
|
st.line_chart(df_ori["sales"]) |
|
|
|
|
|
st.header("Make a Forecast Here: ") |
|
ds= st.date_input(label= "Please enter the date you want to forecast.") |
|
transactions= st.number_input(label= "Please enter the total number of expected transactions") |
|
onpromotion= st.number_input(label= "Please enter the total number of expected items to be on promotions") |
|
|
|
|
|
|
|
input_data= [ds, onpromotion, transactions] |
|
inputs= pd.DataFrame([input_data], columns=["ds", "onpromotion", "transactions"]) |
|
forecast= model.predict(inputs) |
|
|
|
|
|
st.header("Your Prediction is Displayed Below: ") |
|
|
|
|
|
|
|
ok= st.button('forecast sales') |
|
if ok: |
|
input_data= [ds,onpromotion,transactions] |
|
inputs= pd.DataFrame([input_data],columns=['ds','onpromotion','transactions']) |
|
|
|
forecast=model.predict(inputs) |
|
output_values=forecast['yhat'] |
|
st.success (f'the estimated forecast sales ${output_values.values[0]:.2f}') |
|
|