File size: 334 Bytes
b2de734 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from transformers import pipeline
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class TextInput(BaseModel):
text: str
classifier = pipeline("text-classification", model="./")
@app.post("/predict")
async def predict(input_data: TextInput):
result = classifier(input_data.text)
return result |