Spaces:
Runtime error
Runtime error
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 | |
async def classify_text(item: Item): | |
return {"result": spam_classifier.predict([item.text])[0]} | |