From 7393c1f99c9e33871e8b4aaad45f2675e7b410af Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 3 Jun 2023 13:55:35 +0300 Subject: Added sysinfo tab to settings --- modules/ui_settings.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'modules/ui_settings.py') diff --git a/modules/ui_settings.py b/modules/ui_settings.py index 7874298e..49445bd8 100644 --- a/modules/ui_settings.py +++ b/modules/ui_settings.py @@ -1,6 +1,6 @@ import gradio as gr -from modules import ui_common, shared, script_callbacks, scripts, sd_models +from modules import ui_common, shared, script_callbacks, scripts, sd_models, sysinfo from modules.call_queue import wrap_gradio_call from modules.shared import opts from modules.ui_components import FormRow @@ -157,6 +157,17 @@ class UiSettings: with gr.TabItem("Defaults", id="defaults", elem_id="settings_tab_defaults"): loadsave.create_ui() + with gr.TabItem("Sysinfo", id="sysinfo", elem_id="settings_tab_sysinfo"): + gr.HTML('Download system info', elem_id="sysinfo_download") + + with gr.Row(): + with gr.Column(scale=1): + sysinfo_check_file = gr.File(label="Check system info for validity", type='binary') + with gr.Column(scale=1): + sysinfo_check_output = gr.HTML("", elem_id="sysinfo_validity") + with gr.Column(scale=100): + pass + with gr.TabItem("Actions", id="actions", elem_id="settings_tab_actions"): request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications") download_localization = gr.Button(value='Download localization template', elem_id="download_localization") @@ -215,6 +226,21 @@ class UiSettings: outputs=[], ) + def check_file(x): + if x is None: + return '' + + if sysinfo.check(x.decode('utf8', errors='ignore')): + return 'Valid' + + return 'Invalid' + + sysinfo_check_file.change( + fn=check_file, + inputs=[sysinfo_check_file], + outputs=[sysinfo_check_output], + ) + self.interface = settings_interface def add_quicksettings(self): -- cgit v1.2.3 From aeba3cadd5efaa14fe06ef34df26903b5a778e49 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 4 Jun 2023 11:16:00 +0300 Subject: add whitelist for environment in the report add extra link to view the report instead of downloading it --- modules/sysinfo.py | 30 +++++++++++++++++++++++++++++- modules/ui_settings.py | 2 +- style.css | 5 ++++- 3 files changed, 34 insertions(+), 3 deletions(-) (limited to 'modules/ui_settings.py') diff --git a/modules/sysinfo.py b/modules/sysinfo.py index f630c58b..5f15ac4f 100644 --- a/modules/sysinfo.py +++ b/modules/sysinfo.py @@ -13,6 +13,30 @@ import launch from modules import paths_internal, timer checksum_token = "DontStealMyGamePlz__WINNERS_DONT_USE_DRUGS__DONT_COPY_THAT_FLOPPY" +environment_whitelist = { + "GIT", + "INDEX_URL", + "WEBUI_LAUNCH_LIVE_OUTPUT", + "GRADIO_ANALYTICS_ENABLED", + "PYTHONPATH", + "TORCH_INDEX_URL", + "TORCH_COMMAND", + "REQS_FILE", + "XFORMERS_PACKAGE", + "GFPGAN_PACKAGE", + "CLIP_PACKAGE", + "OPENCLIP_PACKAGE", + "STABLE_DIFFUSION_REPO", + "K_DIFFUSION_REPO", + "CODEFORMER_REPO", + "BLIP_REPO", + "STABLE_DIFFUSION_COMMIT_HASH", + "K_DIFFUSION_COMMIT_HASH", + "CODEFORMER_COMMIT_HASH", + "BLIP_COMMIT_HASH", + "COMMANDLINE_ARGS", + "IGNORE_CMD_ARGS_ERRORS", +} def pretty_bytes(num, suffix="B"): @@ -72,7 +96,7 @@ def get_dict(): }, "Extensions": get_extensions(enabled=True), "Inactive extensions": get_extensions(enabled=False), - "Environment": {k: os.environ[k] for k in sorted(os.environ)}, + "Environment": get_environment(), "Config": get_config(), "Startup": timer.startup_record, "Packages": sorted([f"{pkg.key}=={pkg.version}" for pkg in pkg_resources.working_set]), @@ -94,6 +118,10 @@ def get_exceptions(): return str(e) +def get_environment(): + return {k: os.environ[k] for k in sorted(os.environ) if k in environment_whitelist} + + re_newline = re.compile(r"\r*\n") diff --git a/modules/ui_settings.py b/modules/ui_settings.py index 49445bd8..892c5e1a 100644 --- a/modules/ui_settings.py +++ b/modules/ui_settings.py @@ -158,7 +158,7 @@ class UiSettings: loadsave.create_ui() with gr.TabItem("Sysinfo", id="sysinfo", elem_id="settings_tab_sysinfo"): - gr.HTML('Download system info', elem_id="sysinfo_download") + gr.HTML('Download system info
(or open as text in a new page)', elem_id="sysinfo_download") with gr.Row(): with gr.Column(scale=1): diff --git a/style.css b/style.css index d8bdb73b..e1df716f 100644 --- a/style.css +++ b/style.css @@ -450,8 +450,11 @@ table.popup-table .link{ opacity: 0.75; } -#sysinfo_download a{ +#sysinfo_download a.sysinfo_big_link{ font-size: 24pt; +} + +#sysinfo_download a{ text-decoration: underline; } -- cgit v1.2.3