Magnus Persson
Add the Hugging Face image adapter, billing-safe retries and try_image script
6494c95 Download src/logging_setup.py from magnusp/image-lab: direct link, hf CLI and curl.
- Browser
- Download file 570 Bytes
-
https://huggingface.co/spaces/magnusp/image-lab/resolve/main/src/logging_setup.py
- Command line
-
hf download hf://spaces/magnusp/image-lab/src/logging_setup.py
-
curl -L -o logging_setup.py https://huggingface.co/spaces/magnusp/image-lab/resolve/main/src/logging_setup.py
570 Bytes
| """Logging setup shared by the app and the scripts. | |
| Libraries that log request URLs (httpx, httpcore, huggingface_hub) are kept at WARNING so provider | |
| and CDN URLs never reach the logs. Our own loggers stay at INFO. | |
| """ | |
| from __future__ import annotations | |
| import logging | |
| QUIET_LOGGERS = ("httpx", "httpcore", "huggingface_hub") | |
| def configure_logging(fmt: str = "%(asctime)s %(levelname)s %(name)s %(message)s") -> None: | |
| logging.basicConfig(level=logging.INFO, format=fmt) | |
| for name in QUIET_LOGGERS: | |
| logging.getLogger(name).setLevel(logging.WARNING) | |