From 3989d7e88bf82d50f5a72d759346070df1bc2097 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 30 Aug 2023 08:07:15 +0300 Subject: [PATCH] Merge pull request #12838 from bluelovers/pr/file-metadata-path-001 display file metadata `path` , `ss_output_name` --- extensions-builtin/Lora/ui_edit_user_metadata.py | 1 + modules/ui_extra_networks_user_metadata.py | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/extensions-builtin/Lora/ui_edit_user_metadata.py b/extensions-builtin/Lora/ui_edit_user_metadata.py index 390d9dde3..c70119090 100644 --- a/extensions-builtin/Lora/ui_edit_user_metadata.py +++ b/extensions-builtin/Lora/ui_edit_user_metadata.py @@ -70,6 +70,7 @@ class LoraUserMetadataEditor(ui_extra_networks_user_metadata.UserMetadataEditor) metadata = item.get("metadata") or {} keys = { + 'ss_output_name': "Output name:", 'ss_sd_model_name': "Model:", 'ss_clip_skip': "Clip skip:", 'ss_network_module': "Kohya module:", diff --git a/modules/ui_extra_networks_user_metadata.py b/modules/ui_extra_networks_user_metadata.py index b11622a1a..588f84c75 100644 --- a/modules/ui_extra_networks_user_metadata.py +++ b/modules/ui_extra_networks_user_metadata.py @@ -2,10 +2,20 @@ import datetime import html import json import os.path +from pathlib import Path import gradio as gr from modules import generation_parameters_copypaste, images, sysinfo, errors +from modules.paths_internal import models_path + + +def exclude_root_path(root_path, path): + path_object = Path(path) + if path_object.is_relative_to(root_path): + path_object = path_object.relative_to(root_path) + + return path_object.as_posix() class UserMetadataEditor: @@ -98,6 +108,7 @@ class UserMetadataEditor: stats = os.stat(filename) params = [ ('Filename: ', os.path.basename(filename)), + ('Path: ', exclude_root_path(models_path, filename)), ('File size: ', sysinfo.pretty_bytes(stats.st_size)), ('Hash: ', shorthash), ('Modified: ', datetime.datetime.fromtimestamp(stats.st_mtime).strftime('%Y-%m-%d %H:%M')),