Update app.py
Browse filesadding logic model test to app.py
app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
|
|
|
| 2 |
|
| 3 |
app = FastAPI()
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|