Salcidio commited on
Commit ·
6040afc
1
Parent(s): 8c94d04
curl
Browse files
app.py
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
model = pipeline("summarization", model="facebook/bart-large-cnn")
|
| 7 |
+
|
| 8 |
+
class TextIn(BaseModel):
|
| 9 |
+
text: str
|
| 10 |
+
|
| 11 |
+
@app.post("/summarize")
|
| 12 |
+
async def summarize(item: TextIn):
|
| 13 |
+
response = model(item.text)
|
| 14 |
+
return response
|