Spaces:
Runtime error
Runtime error
File size: 414 Bytes
d57b505 6afa36a 0433163 cdc5783 0433163 cdc5783 6afa36a d57b505 cdc5783 d57b505 0433163 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from fastapi import FastAPI
from pydantic import BaseModel
from summary import summarize
KEY = 'J9l#K4wP5h@2'
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
class SummaryReq(BaseModel):
text: str
key: str
@app.post("/summary/")
async def summary(request: SummaryReq):
if request.key != KEY:
return 'Unauthorized'
return summarize(request.text)
|