File size: 328 Bytes
6040afc c5ccb1e 6040afc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | from fastapi import FastAPI
from pydantic import BaseModel
from transformers import pipeline
app = FastAPI()
model = pipeline("summarization", model="facebook/bart-large-cnn")
class TextIn(BaseModel):
text: str
@app.post("/summarize")
async def summarize(item: TextIn):
response = model(item.text)
return response |