Spaces:
Runtime error
Runtime error
Download core/dependencies.py from cloudaiRambo/cloudairambo: direct link, hf CLI and curl.
- Browser
- Download file 596 Bytes
-
https://huggingface.co/spaces/cloudaiRambo/cloudairambo/resolve/main/core/dependencies.py
- Command line
-
hf download hf://spaces/cloudaiRambo/cloudairambo/core/dependencies.py
-
curl -L -o dependencies.py https://huggingface.co/spaces/cloudaiRambo/cloudairambo/resolve/main/core/dependencies.py
596 Bytes
| # core/dependencies.py | |
| from fastapi import Depends | |
| from sqlalchemy.orm import Session | |
| from services.stats_service import increment_tool_usage | |
| from core.database import get_db | |
| def LogToolUsage(tool_name: str, event_type: str = "open"): | |
| """ | |
| Logs tool usage automatically when added as a dependency. | |
| tool_name → name of the tool: "audio_compress", "pdf_split", etc. | |
| event_type → "open", "process", or "download" | |
| """ | |
| def log_and_pass(db: Session = Depends(get_db)): | |
| increment_tool_usage(db, tool_name, event_type) | |
| return None | |
| return log_and_pass | |