Download docker_prepare.py from Sunday01/testapi: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/spaces/Sunday01/testapi/resolve/main/docker_prepare.py
- Command line
-
hf download hf://spaces/Sunday01/testapi/docker_prepare.py
-
curl -L -o docker_prepare.py https://huggingface.co/spaces/Sunday01/testapi/resolve/main/docker_prepare.py
707 Bytes
| import asyncio | |
| from manga_translator.utils import ModelWrapper | |
| from manga_translator.detection import DETECTORS | |
| from manga_translator.ocr import OCRS | |
| from manga_translator.inpainting import INPAINTERS | |
| async def download(dict): | |
| for key, value in dict.items(): | |
| if issubclass(value, ModelWrapper): | |
| print(' -- Downloading', key) | |
| try: | |
| inst = value() | |
| await inst.download() | |
| except Exception as e: | |
| print('Failed to download', key, value) | |
| print(e) | |
| async def main(): | |
| await download(DETECTORS) | |
| await download(OCRS) | |
| await download({ | |
| k: v for k, v in INPAINTERS.items() | |
| if k not in ['sd'] | |
| }) | |
| if __name__ == '__main__': | |
| asyncio.run(main()) | |