Spaces:
Runtime error
Runtime error
from fastapi import FastAPI,Request | |
from fastapi.middleware.cors import CORSMiddleware | |
app = FastAPI() | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=["*"], | |
allow_credentials=True, | |
allow_methods=["*"], | |
allow_headers=["*"], | |
) | |
async def ping(): | |
return "Hello, the retriever is working" | |
async def section(request: Request): | |
data = await request.json() | |
from final_book_retriever import answer | |
answer = answer(data["Question"]) | |
return {"Answer": answer} | |