Spaces:
Runtime error
Runtime error
quyip
commited on
Commit
·
6afa36a
1
Parent(s):
12cbe20
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,15 @@ async def root():
|
|
10 |
return {"message": "Hello World"}
|
11 |
|
12 |
|
|
|
|
|
|
|
|
|
13 |
@app.post("/summary/")
|
14 |
-
async def summary(
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
|
19 |
@app.get("/summary2/{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 SummaryReq(BaseModel):
|
15 |
+
text: str
|
16 |
+
key: str
|
17 |
+
|
18 |
@app.post("/summary/")
|
19 |
+
async def summary(request: SummaryReq):
|
20 |
+
print('=============')
|
21 |
+
print(request)
|
22 |
+
return summarize(request.text)
|
23 |
|
24 |
|
25 |
@app.get("/summary2/{text}")
|