Download app/utils/cloudinary_utils.py from Gaykar/AdaptiveEngineService: direct link, hf CLI and curl.
- Browser
- Download file 839 Bytes
-
https://huggingface.co/spaces/Gaykar/AdaptiveEngineService/resolve/main/app/utils/cloudinary_utils.py
- Command line
-
hf download hf://spaces/Gaykar/AdaptiveEngineService/app/utils/cloudinary_utils.py
-
curl -L -o cloudinary_utils.py https://huggingface.co/spaces/Gaykar/AdaptiveEngineService/resolve/main/app/utils/cloudinary_utils.py
839 Bytes
| import cloudinary | |
| from cloudinary import Search | |
| from app.core.config import settings | |
| # Configure | |
| cloudinary.config( | |
| cloud_name=settings.CLOUDINARY_CLOUD_NAME, | |
| api_key=settings.CLOUDINARY_API_KEY, | |
| api_secret=settings.CLOUDINARY_API_SECRET, | |
| secure=True | |
| ) | |
| def get_resume_url(thread_id: str) -> str: | |
| """ | |
| Searches Cloudinary for the resume PDF in the thread's folder | |
| and returns the secure URL. | |
| """ | |
| result = Search() \ | |
| .expression(f'folder:"threads/{thread_id}/*"') \ | |
| .sort_by('public_id', 'desc') \ | |
| .max_results(1) \ | |
| .execute() | |
| resources = result.get("resources", []) | |
| if not resources: | |
| raise FileNotFoundError(f"No resume found for thread_id: {thread_id}") | |
| pdf_url = resources[0]["secure_url"] | |
| print(f"Found resume: {pdf_url}") | |
| return pdf_url |