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