Spaces:
Runtime error
Runtime error
quyip
commited on
Commit
·
30007f4
1
Parent(s):
c034d4c
fix
Browse files
main.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
from summary import summarize
|
| 4 |
|
|
@@ -10,10 +11,14 @@ async def root():
|
|
| 10 |
return {"message": "Hello World"}
|
| 11 |
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
@app.post("/summary/")
|
| 14 |
async def summary(text_request):
|
| 15 |
-
text = text_request.text
|
| 16 |
-
print(text_request.key)
|
| 17 |
-
print(text)
|
| 18 |
print('==============')
|
|
|
|
|
|
|
| 19 |
return summarize(text)
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from pydantic import BaseModel
|
| 3 |
|
| 4 |
from summary import summarize
|
| 5 |
|
|
|
|
| 11 |
return {"message": "Hello World"}
|
| 12 |
|
| 13 |
|
| 14 |
+
class TextRequest(BaseModel):
|
| 15 |
+
text: str
|
| 16 |
+
key: str
|
| 17 |
+
|
| 18 |
+
|
| 19 |
@app.post("/summary/")
|
| 20 |
async def summary(text_request):
|
|
|
|
|
|
|
|
|
|
| 21 |
print('==============')
|
| 22 |
+
print(text_request)
|
| 23 |
+
text = text_request.text
|
| 24 |
return summarize(text)
|