I'm using pycaret as my ML workflow, I tried to create an API using FastAPI. This is my first time playing into production level, so I'm bit confused about API
I have 10 features; age: float, live_province: str, live_city: str, live_area_big: str, live_area_small: str, sex: float, marital: float, bank: str, salary: float, amount: float and a label which it contains the binary value (0 and 1).
This is what my script for building the API
from pydantic import BaseModel
import numpy as np
from pycaret.classification import *
import uvicorn
from fastapi import FastAPI
app = FastAPI()
model = load_model('catboost_cm_creditable')
class Data(BaseModel):
age: float
live_province: str
live_city: str
live_area_big: str
live_area_small: str
sex: float
marital: float
bank: str
salary: float
amount: float
input_dict = Data
@app.post("/predict")
def predict(model, input_dict):
predictions_df = predict_model(estimator=model, data=input_dict)
predictions = predictions_df['Score'][0]
return predictions
When I tried to run uvicorn script:app
and went to the documentation I can't find the parameter for my features, the parameters only show model and input_dict
How to take my Features onto Parameters in the API?