Spaces:
Sleeping
Sleeping
File size: 853 Bytes
0ec3d9b 51abf05 2998f77 51abf05 5a56710 0ec3d9b 51abf05 8c9dd24 66191ca 13e1b1e 51abf05 5a56710 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import pickle
import pandas as pd
# In your model training script and your Streamlit app script (app.py)
from transformers import UnitPriceTransformer, KMeansAndLabelTransformer, DynamicOneHotEncoder
# Load the pipeline and model
# Load the pipeline object from the file
with open('full_pipeline_with_unit_price.pkl', 'rb') as file:
pipeline = pickle.load(file)
# Load the preprocessor object from the file
with open('preprocessor.pkl', 'rb') as file:
preprocessor = pickle.load(file)
# Load the model object from the file
with open('best_model.pkl', 'rb') as file:
model = pickle.load(file)
def make_prediction(input_features):
# Assuming input_features is a DataFrame with the correct structure
processed_features = pipeline.transform(input_features)
prediction = model.predict(processed_features)
return prediction[0]
|