Spaces:
Sleeping
Sleeping
Download src/main.py from harshith-7/discover-agent: direct link, hf CLI and curl.
- Browser
- Download file 626 Bytes
-
https://huggingface.co/spaces/harshith-7/discover-agent/resolve/main/src/main.py
- Command line
-
hf download hf://spaces/harshith-7/discover-agent/src/main.py
-
curl -L -o main.py https://huggingface.co/spaces/harshith-7/discover-agent/resolve/main/src/main.py
626 Bytes
| import uvicorn | |
| from fastapi import FastAPI, Request | |
| from fastapi.responses import JSONResponse | |
| from helper import helper | |
| import logging | |
| app = FastAPI() | |
| async def get_answer(request: Request): | |
| body = await request.json() | |
| query = body.get('query') | |
| print("Sending to generate the answer") | |
| answers = helper.generate(query) | |
| for answer in answers: | |
| answer.pretty_print() | |
| print("Sending response") | |
| return JSONResponse(content={'answer': answers[-1].content}, status_code=200) | |
| if __name__=="__main__": | |
| uvicorn.run(app, host="localhost", port=2911) |