Jiahuita
Attempt to resolve deployment issue
b2de734
raw
history blame
334 Bytes
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