From 34d6ea43196007173e47757e44a27a2b6bd827ef Mon Sep 17 00:00:00 2001 From: Abhishek Varma Date: Wed, 6 Sep 2023 15:04:02 +0000 Subject: [PATCH] Add logging feature in WebUI -- This commit adds logging feature in WebUI based on `debug` flag. Signed-off-by: Abhishek Varma --- apps/stable_diffusion/src/utils/stable_args.py | 7 +++++++ apps/stable_diffusion/web/index.py | 3 +++ 2 files changed, 10 insertions(+) diff --git a/apps/stable_diffusion/src/utils/stable_args.py b/apps/stable_diffusion/src/utils/stable_args.py index 74626f9ed9..6636bd44f1 100644 --- a/apps/stable_diffusion/src/utils/stable_args.py +++ b/apps/stable_diffusion/src/utils/stable_args.py @@ -633,6 +633,13 @@ def is_valid_file(arg): help="Flag for enabling rest API.", ) +p.add_argument( + "--debug", + default=False, + action=argparse.BooleanOptionalAction, + help="Flag for enabling debugging log in WebUI.", +) + p.add_argument( "--output_gallery", default=True, diff --git a/apps/stable_diffusion/web/index.py b/apps/stable_diffusion/web/index.py index dcb1e570f3..b587130f90 100644 --- a/apps/stable_diffusion/web/index.py +++ b/apps/stable_diffusion/web/index.py @@ -1,6 +1,7 @@ from multiprocessing import Process, freeze_support import os import sys +import logging if sys.platform == "darwin": # import before IREE to avoid torch-MLIR library issues @@ -41,6 +42,8 @@ def launch_app(address): if __name__ == "__main__": + if args.debug: + logging.basicConfig(level=logging.DEBUG) # required to do multiprocessing in a pyinstaller freeze freeze_support() if args.api or "api" in args.ui.split(","):