Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,11 +35,13 @@ ml_models = {}
|
|
| 35 |
async def lifespan(app: FastAPI):
|
| 36 |
# This code runs ONCE when the application starts up
|
| 37 |
print("🚀 Initializing models and prompt template...")
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
|
| 44 |
# Load models into the shared dictionary
|
| 45 |
ml_models["embedder"] = HuggingFaceEmbeddings(model_name="BAAI/bge-base-en-v1.5")
|
|
|
|
| 35 |
async def lifespan(app: FastAPI):
|
| 36 |
# This code runs ONCE when the application starts up
|
| 37 |
print("🚀 Initializing models and prompt template...")
|
| 38 |
+
|
| 39 |
+
try:
|
| 40 |
+
GOOGLE_API_KEY = os.getenv("gemini_api_key")
|
| 41 |
+
print("🔑 gemini_api_key:", "FOUND" if GOOGLE_API_KEY else "NOT FOUND")
|
| 42 |
+
|
| 43 |
+
if not GOOGLE_API_KEY:
|
| 44 |
+
raise RuntimeError("CRITICAL: Missing GOOGLE_API_KEY in environment secrets!")
|
| 45 |
|
| 46 |
# Load models into the shared dictionary
|
| 47 |
ml_models["embedder"] = HuggingFaceEmbeddings(model_name="BAAI/bge-base-en-v1.5")
|