Spaces:
Runtime error
Runtime error
File size: 948 Bytes
bcbc2e2 |
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 |
import streamlit as st
import pandas as pd
import pickle
import json
# from statsmodels.tsa.holtwinters import ExponentialSmoothing
# Load All Files
with open('model_forecasting.pkl', 'rb') as file_1:
model = pickle.load(file_1)
def run():
# create Streamlit app
st.title('Demand Forecasting')
# display prediction
# st.write('Prediction:', prediction)
with st.form(key='form_forecasting_2022'):
start_date = st.date_input(
'Start date', value=pd.to_datetime('2023-04-16'))
end_date = st.date_input(
'End date', value=pd.to_datetime('2023-04-30'))
st.markdown('---')
submitted = st.form_submit_button('Predict')
if submitted:
prediction = model.predict(start=start_date, end=end_date)
st.write("Hasil prediksi pada tanggal ", start_date, ":", prediction)
# agar bisa di run sendiri, tanpa dari main
if __name__ == '__main__':
run()
|