Spaces:
Runtime error
Runtime error
| import os | |
| from motor.motor_asyncio import AsyncIOMotorClient | |
| # Get the MongoDB URI from Hugging Face secrets | |
| MONGO_URI = os.environ.get("MONGODB_URI") | |
| # Initialize the async MongoDB client | |
| client = AsyncIOMotorClient(MONGO_URI) | |
| # Automatically get the default database (from the URI) | |
| db = client.get_default_database() | |
| # Expose collections | |
| patients_collection = db["patients"] | |
| results_collection = db["patient_analysis_results"] | |