File size: 457 Bytes
05a1079 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from fastapi import FastAPI
import joblib
import numpy as np
# Load your model
model = joblib.load("linear_regression_model.joblib")
app = FastAPI()
@app.post("/predict")
def predict(input_data: list):
# Convert input to numpy array and reshape if necessary
input_array = np.array(input_data).reshape(1, -1) # Adjust the shape based on your model's input
prediction = model.predict(input_array)
return {"prediction": prediction.tolist()} |