Spaces:
Runtime error
Runtime error
bagus
commited on
Commit
•
bcbc2e2
1
Parent(s):
a4e2d19
first deploy
Browse files- app.py +10 -0
- model_forecasting.pkl +3 -0
- prediction.py +38 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
# import eda
|
3 |
+
import prediction
|
4 |
+
|
5 |
+
navigation = st.sidebar.selectbox('Pilih halaman:', ('Demand Forecast'))
|
6 |
+
|
7 |
+
if navigation == 'Demand Forecast':
|
8 |
+
prediction.run()
|
9 |
+
else:
|
10 |
+
prediction.run()
|
model_forecasting.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:10e6158d8af59fd0e6d054302c4ac322f87e30a118215a0e687511d53c7bba45
|
3 |
+
size 12151
|
prediction.py
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import pickle
|
4 |
+
import json
|
5 |
+
# from statsmodels.tsa.holtwinters import ExponentialSmoothing
|
6 |
+
|
7 |
+
# Load All Files
|
8 |
+
|
9 |
+
with open('model_forecasting.pkl', 'rb') as file_1:
|
10 |
+
model = pickle.load(file_1)
|
11 |
+
|
12 |
+
|
13 |
+
def run():
|
14 |
+
|
15 |
+
# create Streamlit app
|
16 |
+
st.title('Demand Forecasting')
|
17 |
+
|
18 |
+
# display prediction
|
19 |
+
# st.write('Prediction:', prediction)
|
20 |
+
|
21 |
+
with st.form(key='form_forecasting_2022'):
|
22 |
+
start_date = st.date_input(
|
23 |
+
'Start date', value=pd.to_datetime('2023-04-16'))
|
24 |
+
end_date = st.date_input(
|
25 |
+
'End date', value=pd.to_datetime('2023-04-30'))
|
26 |
+
st.markdown('---')
|
27 |
+
|
28 |
+
submitted = st.form_submit_button('Predict')
|
29 |
+
|
30 |
+
if submitted:
|
31 |
+
|
32 |
+
prediction = model.predict(start=start_date, end=end_date)
|
33 |
+
st.write("Hasil prediksi pada tanggal ", start_date, ":", prediction)
|
34 |
+
|
35 |
+
|
36 |
+
# agar bisa di run sendiri, tanpa dari main
|
37 |
+
if __name__ == '__main__':
|
38 |
+
run()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit == 1.20.0
|
2 |
+
pandas == 1.5.3
|
3 |
+
pickle
|