Spaces:
Running on T4
Running on T4
Update app.py
Browse files
app.py
CHANGED
|
@@ -246,23 +246,25 @@ def get_app_db_collections(appname: Optional[str] = None):
|
|
| 246 |
Returns (media_clicks_collection, subcategories_collection)
|
| 247 |
based on appname.
|
| 248 |
"""
|
|
|
|
| 249 |
if appname:
|
| 250 |
app = appname.strip().lower()
|
| 251 |
|
| 252 |
if app == "collage-maker":
|
| 253 |
-
if collage_media_clicks_col and subcategories_col:
|
| 254 |
return collage_media_clicks_col, subcategories_col
|
| 255 |
logger.warning("Collage-maker DB not configured, falling back to admin")
|
| 256 |
|
| 257 |
elif app == "ai-enhancer":
|
| 258 |
-
if ai_enhancer_media_clicks_col and ai_enhancer_subcategories_col:
|
| 259 |
return ai_enhancer_media_clicks_col, ai_enhancer_subcategories_col
|
| 260 |
logger.warning("AI-Enhancer DB not configured, falling back to admin")
|
| 261 |
|
| 262 |
-
# default
|
| 263 |
return media_clicks_col, subcategories_col
|
| 264 |
|
| 265 |
|
|
|
|
| 266 |
# --------------------- Logging API Hits ---------------------
|
| 267 |
async def log_faceswap_hit(token: str, status: str = "success"):
|
| 268 |
global database
|
|
|
|
| 246 |
Returns (media_clicks_collection, subcategories_collection)
|
| 247 |
based on appname.
|
| 248 |
"""
|
| 249 |
+
|
| 250 |
if appname:
|
| 251 |
app = appname.strip().lower()
|
| 252 |
|
| 253 |
if app == "collage-maker":
|
| 254 |
+
if collage_media_clicks_col is not None and subcategories_col is not None:
|
| 255 |
return collage_media_clicks_col, subcategories_col
|
| 256 |
logger.warning("Collage-maker DB not configured, falling back to admin")
|
| 257 |
|
| 258 |
elif app == "ai-enhancer":
|
| 259 |
+
if ai_enhancer_media_clicks_col is not None and ai_enhancer_subcategories_col is not None:
|
| 260 |
return ai_enhancer_media_clicks_col, ai_enhancer_subcategories_col
|
| 261 |
logger.warning("AI-Enhancer DB not configured, falling back to admin")
|
| 262 |
|
| 263 |
+
# default fallback
|
| 264 |
return media_clicks_col, subcategories_col
|
| 265 |
|
| 266 |
|
| 267 |
+
|
| 268 |
# --------------------- Logging API Hits ---------------------
|
| 269 |
async def log_faceswap_hit(token: str, status: str = "success"):
|
| 270 |
global database
|