Spaces:
Sleeping
Sleeping
Download database.py from Phoenix1410/LEXGUARD_API: direct link, hf CLI and curl.
- Browser
- Download file 369 Bytes
-
https://huggingface.co/spaces/Phoenix1410/LEXGUARD_API/resolve/main/database.py
- Command line
-
hf download hf://spaces/Phoenix1410/LEXGUARD_API/database.py
-
curl -L -o database.py https://huggingface.co/spaces/Phoenix1410/LEXGUARD_API/resolve/main/database.py
369 Bytes
| from motor.motor_asyncio import AsyncIOMotorClient | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| MONGO_URI = os.getenv("MONGODB_URI") | |
| if not MONGO_URI: | |
| print("⚠️ WARNING: MONGODB_URI is not set in environment variables.") | |
| # Create a global client instance | |
| client = AsyncIOMotorClient(MONGO_URI) | |
| db = client.lexguard_db # Database name | |