Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- app.py +37 -0
- model_iterative.pkl +3 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import joblib
|
| 4 |
+
|
| 5 |
+
with open('model_iterative.pkl', 'rb') as model_file:
|
| 6 |
+
model = joblib.load(model_file)
|
| 7 |
+
|
| 8 |
+
def predict_total_order(week_of_month, day_of_week, order_type_a, order_type_b, order_type_c):
|
| 9 |
+
|
| 10 |
+
input_data = {
|
| 11 |
+
'Week of the month': week_of_month,
|
| 12 |
+
'Day of the week': day_of_week,
|
| 13 |
+
'Order type A': order_type_a,
|
| 14 |
+
'Order type B': order_type_b,
|
| 15 |
+
'Order type C': order_type_c,
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
input_df = pd.DataFrame([input_data])
|
| 19 |
+
total_order_prediction = model.predict(input_df)
|
| 20 |
+
return total_order_prediction
|
| 21 |
+
|
| 22 |
+
def run():
|
| 23 |
+
st.title('Total Order Prediction')
|
| 24 |
+
st.subheader('Input Features')
|
| 25 |
+
|
| 26 |
+
week_of_month = st.number_input('Week of the month', min_value=0, max_value=4, step=1)
|
| 27 |
+
day_of_week = st.number_input('Day of the week', min_value=0, max_value=7, step=1)
|
| 28 |
+
order_type_a = st.number_input('Order type A', value=0.0)
|
| 29 |
+
order_type_b = st.number_input('Order type B', value=0.0)
|
| 30 |
+
order_type_c = st.number_input('Order type C', value=0.0)
|
| 31 |
+
|
| 32 |
+
if st.button('Predict Total Order'):
|
| 33 |
+
total_order_prediction = predict_total_order(week_of_month, day_of_week, order_type_a, order_type_b, order_type_c)
|
| 34 |
+
st.success(f'Predicted Total Order: {total_order_prediction[0]:.2f}')
|
| 35 |
+
|
| 36 |
+
if __name__ == '__main__':
|
| 37 |
+
run()
|
model_iterative.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22bf91838360774db64478c9ea3524d34e6919e44e1cfc02b69d9a84658e9351
|
| 3 |
+
size 1008
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
scikit-learn
|