File size: 707 Bytes
9dce458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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())