Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +5 -5
- prediction.py +1 -2
app.py
CHANGED
@@ -11,8 +11,7 @@ from eda import (average_sales_by_region, average_sales_and_profit_over_time,
|
|
11 |
segment_vs_region_distribution, sales_vs_profit_across_segments,
|
12 |
category_composition_for_profit_and_sales)
|
13 |
|
14 |
-
|
15 |
-
model = joblib.load('best_model.pkl')
|
16 |
|
17 |
# Load the dataset for EDA
|
18 |
@st.cache_data
|
@@ -68,8 +67,9 @@ elif selection == "Make a Prediction":
|
|
68 |
'Sales', 'Discount', 'Quantity', 'Sub-Category'
|
69 |
])
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
predicted_profit =
|
74 |
|
|
|
75 |
st.write(f'Predicted Profit: {predicted_profit:.2f}')
|
|
|
11 |
segment_vs_region_distribution, sales_vs_profit_across_segments,
|
12 |
category_composition_for_profit_and_sales)
|
13 |
|
14 |
+
from prediction import make_prediction
|
|
|
15 |
|
16 |
# Load the dataset for EDA
|
17 |
@st.cache_data
|
|
|
67 |
'Sales', 'Discount', 'Quantity', 'Sub-Category'
|
68 |
])
|
69 |
|
70 |
+
|
71 |
+
|
72 |
+
predicted_profit = make_prediction(input_features) # Adjust this line as necessary
|
73 |
|
74 |
+
|
75 |
st.write(f'Predicted Profit: {predicted_profit:.2f}')
|
prediction.py
CHANGED
@@ -52,7 +52,6 @@ model = joblib.load('best_model.pkl')
|
|
52 |
preprocessor = joblib.load('preprocessor.pkl')
|
53 |
|
54 |
def make_prediction(input_features):
|
55 |
-
|
56 |
-
processed_features = pipeline.transform(encoded_features)
|
57 |
prediction = model.predict(processed_features)
|
58 |
return prediction[0]
|
|
|
52 |
preprocessor = joblib.load('preprocessor.pkl')
|
53 |
|
54 |
def make_prediction(input_features):
|
55 |
+
processed_features = pipeline.transform(input_features)
|
|
|
56 |
prediction = model.predict(processed_features)
|
57 |
return prediction[0]
|