Spaces:
Runtime error
Runtime error
Download backend/app/api/deps.py from prathvi9607/vera-api: direct link, hf CLI and curl.
- Browser
- Download file 372 Bytes
-
https://huggingface.co/spaces/prathvi9607/vera-api/resolve/main/backend/app/api/deps.py
- Command line
-
hf download hf://spaces/prathvi9607/vera-api/backend/app/api/deps.py
-
curl -L -o deps.py https://huggingface.co/spaces/prathvi9607/vera-api/resolve/main/backend/app/api/deps.py
372 Bytes
| """Shared FastAPI dependencies.""" | |
| from __future__ import annotations | |
| from collections.abc import Generator | |
| from sqlalchemy.orm import Session | |
| from app.database import SessionLocal | |
| def get_db() -> Generator[Session, None, None]: | |
| """Yield one request-scoped SQLAlchemy session.""" | |
| db = SessionLocal() | |
| try: | |
| yield db | |
| finally: | |
| db.close() | |