File size: 327 Bytes
9e9d4f8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from fastapi import FastAPI
import pandas as pd
import joblib
app = FastAPI()
# Cargar el modelo entrenado
model = joblib.load("model.joblib")
@app.post("/predict")
def predict(data: dict):
df = pd.DataFrame([data])
df = pd.get_dummies(df)
prediction = model.predict(df)
return {"prediction": prediction[0]}
|