# model.py import joblib class LinearRegressionModel: def __init__(self): # Load the model self.model = joblib.load("linear_regression_model.joblib") def get_coefficients(self, columns): # Return coefficients as a dictionary with column names as keys coefficients = dict(zip(columns, self.model.coef_.tolist())) intercept = self.model.intercept_ return {"coefficients": coefficients, "intercept": intercept} # Instantiate the model for inference model = LinearRegressionModel() # Sample usage function to demonstrate def predict(inputs): # Assume 'columns' is a key in the inputs dict with a list of column names columns = inputs.get("columns", []) return model.get_coefficients(columns)