Spaces:
Sleeping
Sleeping
Download app/api/v1/endpoints/trigger.py from HFShishir/tech-updates: direct link, hf CLI and curl.
- Browser
- Download file 855 Bytes
-
https://huggingface.co/spaces/HFShishir/tech-updates/resolve/main/app/api/v1/endpoints/trigger.py
- Command line
-
hf download hf://spaces/HFShishir/tech-updates/app/api/v1/endpoints/trigger.py
-
curl -L -o trigger.py https://huggingface.co/spaces/HFShishir/tech-updates/resolve/main/app/api/v1/endpoints/trigger.py
855 Bytes
| from fastapi import APIRouter, BackgroundTasks | |
| from app.scheduler.cron import run_daily_tech_digest_pipeline | |
| router = APIRouter() | |
| async def trigger_manual_scrape(background_tasks: BackgroundTasks): | |
| """ | |
| Manually triggers the tech update scraping, LangChain AI summarization, ChromaDB indexing, and FCM push notification pipeline. | |
| Runs asynchronously in background tasks. | |
| """ | |
| background_tasks.add_task(run_daily_tech_digest_pipeline) | |
| return { | |
| "status": "triggered", | |
| "message": "Daily tech update pipeline started in background. Check /api/v1/digests/latest shortly." | |
| } | |
| async def trigger_manual_scrape_sync(): | |
| """ | |
| Synchronously triggers the pipeline and returns the result immediately. | |
| """ | |
| result = await run_daily_tech_digest_pipeline() | |
| return result | |