tagger.py 544 B

123456789101112131415161718
  1. from PIL import Image, ImageFile
  2. from modules import script_callbacks
  3. from tagger.api import on_app_started
  4. from tagger.ui import on_ui_tabs
  5. # if you do not initialize the Image object
  6. # Image.registered_extensions() returns only PNG
  7. Image.init()
  8. # PIL spits errors when loading a truncated image by default
  9. # https://pillow.readthedocs.io/en/stable/reference/ImageFile.html#PIL.ImageFile.LOAD_TRUNCATED_IMAGES
  10. ImageFile.LOAD_TRUNCATED_IMAGES = True
  11. script_callbacks.on_app_started(on_app_started)
  12. script_callbacks.on_ui_tabs(on_ui_tabs)