Spaces:
Runtime error
Runtime error
Download api/events.py from Multimedika/Bot_Development: direct link, hf CLI and curl.
- Browser
- Download file 700 Bytes
-
https://huggingface.co/spaces/Multimedika/Bot_Development/resolve/main/api/events.py
- Command line
-
hf download hf://spaces/Multimedika/Bot_Development/api/events.py
-
curl -L -o events.py https://huggingface.co/spaces/Multimedika/Bot_Development/resolve/main/api/events.py
700 Bytes
| import os | |
| from dotenv import load_dotenv | |
| from fastapi import FastAPI | |
| from db.database import engine | |
| from db.models import Base | |
| from llama_index.core import set_global_handler | |
| load_dotenv() | |
| async def startup() -> None: | |
| Base.metadata.create_all(engine) | |
| os.environ["LANGFUSE_SECRET_KEY"] = os.getenv("LANGFUSE_SECRET_KEY") | |
| os.environ["LANGFUSE_PUBLIC_KEY"] = os.getenv("LANGFUSE_PUBLIC_KEY") | |
| os.environ["LANGFUSE_HOST"] = os.getenv("LANGFUSE_HOST") | |
| set_global_handler("langfuse") | |
| async def shutdown() -> None: | |
| pass | |
| def register_events(app: FastAPI) -> FastAPI: | |
| app.add_event_handler("startup", startup) | |
| app.add_event_handler("shutdown", shutdown) | |
| return app | |