Download src/server/routes.py from Partha11/ml-server: direct link, hf CLI and curl.
- Browser
- Download file 463 Bytes
-
https://huggingface.co/spaces/Partha11/ml-server/resolve/main/src/server/routes.py
- Command line
-
hf download hf://spaces/Partha11/ml-server/src/server/routes.py
-
curl -L -o routes.py https://huggingface.co/spaces/Partha11/ml-server/resolve/main/src/server/routes.py
463 Bytes
| from fastapi import Body, FastAPI | |
| from typing_extensions import Annotated | |
| from src.models.request import Request | |
| class Routes: | |
| def __init__(self): | |
| self.api = FastAPI() | |
| async def index(self): | |
| return {'message': 'Hello World!'} | |
| api = FastAPI() | |
| async def query(data: Annotated[Request, Body(embed=True)]): | |
| handler = Handler(data.query) | |
| response = handler.tag() | |
| return {'data': response} |