diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-06-04 08:16:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-04 08:16:32 +0000 |
commit | efc4c79b5ecd0bfff09b5f7bb9acf4b9044207ae (patch) | |
tree | fb49c310b83ca5440da26a678f292c4eb46d1421 /modules/ui.py | |
parent | b4b7e6e5f737538244729e11c9df53787ed35932 (diff) | |
parent | aeba3cadd5efaa14fe06ef34df26903b5a778e49 (diff) | |
download | stable-diffusion-webui-gfx803-efc4c79b5ecd0bfff09b5f7bb9acf4b9044207ae.tar.gz stable-diffusion-webui-gfx803-efc4c79b5ecd0bfff09b5f7bb9acf4b9044207ae.tar.bz2 stable-diffusion-webui-gfx803-efc4c79b5ecd0bfff09b5f7bb9acf4b9044207ae.zip |
Merge pull request #10980 from AUTOMATIC1111/sysinfo
Added sysinfo tab to settings
Diffstat (limited to 'modules/ui.py')
-rw-r--r-- | modules/ui.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/ui.py b/modules/ui.py index 7ae33ab1..4c0fd4d5 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1,3 +1,4 @@ +import datetime
import json
import mimetypes
import os
@@ -11,7 +12,7 @@ import numpy as np from PIL import Image, PngImagePlugin # noqa: F401
from modules.call_queue import wrap_gradio_gpu_call, wrap_queued_call, wrap_gradio_call
-from modules import sd_hijack, sd_models, script_callbacks, ui_extensions, deepbooru, sd_vae, extra_networks, ui_common, ui_postprocessing, progress, ui_loadsave, errors, shared_items, ui_settings, timer
+from modules import sd_hijack, sd_models, script_callbacks, ui_extensions, deepbooru, sd_vae, extra_networks, ui_common, ui_postprocessing, progress, ui_loadsave, errors, shared_items, ui_settings, timer, sysinfo
from modules.ui_components import FormRow, FormGroup, ToolButton, FormHTML
from modules.paths import script_path
from modules.ui_common import create_refresh_button
@@ -1600,3 +1601,15 @@ def setup_ui_api(app): app.add_api_route("/internal/ping", lambda: {}, methods=["GET"])
app.add_api_route("/internal/profile-startup", lambda: timer.startup_record, methods=["GET"])
+
+ def download_sysinfo(attachment=False):
+ from fastapi.responses import PlainTextResponse
+
+ text = sysinfo.get()
+ filename = f"sysinfo-{datetime.datetime.utcnow().strftime('%Y-%m-%d-%H-%M')}.txt"
+
+ return PlainTextResponse(text, headers={'Content-Disposition': f'{"attachment" if attachment else "inline"}; filename="{filename}"'})
+
+ app.add_api_route("/internal/sysinfo", download_sysinfo, methods=["GET"])
+ app.add_api_route("/internal/sysinfo-download", lambda: download_sysinfo(attachment=True), methods=["GET"])
+
|