Download main.py from achdaisy/retriver: direct link, hf CLI and curl.
- Browser
- Download file 522 Bytes
-
https://huggingface.co/spaces/achdaisy/retriver/resolve/main/main.py
- Command line
-
hf download hf://spaces/achdaisy/retriver/main.py
-
curl -L -o main.py https://huggingface.co/spaces/achdaisy/retriver/resolve/main/main.py
522 Bytes
| 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, I am alive" | |
| async def section(request: Request): | |
| data = await request.json() | |
| from doc_retriever_1 import answer | |
| answer = answer(data["Question"]) | |
| return {"Answer": answer} | |