spam_clf / app /app.py
varunkuntal's picture
all added
dc71762
from fastapi import FastAPI
from pydantic import BaseModel
from joblib import load
import pickle
app = FastAPI()
with open('gs_clf.pickle', 'rb') as f:
spam_classifier = pickle.load(f)
class Item(BaseModel):
text: str
@app.post("/classify/")
async def classify_text(item: Item):
return {"result": spam_classifier.predict([item.text])[0]}