Merge pull request #12838 from bluelovers/pr/file-metadata-path-001

display file metadata `path` , `ss_output_name`
This commit is contained in:
AUTOMATIC1111 2023-08-30 08:07:15 +03:00
parent afea99a72b
commit 3989d7e88b
2 changed files with 12 additions and 0 deletions

View File

@ -70,6 +70,7 @@ class LoraUserMetadataEditor(ui_extra_networks_user_metadata.UserMetadataEditor)
metadata = item.get("metadata") or {} metadata = item.get("metadata") or {}
keys = { keys = {
'ss_output_name': "Output name:",
'ss_sd_model_name': "Model:", 'ss_sd_model_name': "Model:",
'ss_clip_skip': "Clip skip:", 'ss_clip_skip': "Clip skip:",
'ss_network_module': "Kohya module:", 'ss_network_module': "Kohya module:",

View File

@ -2,10 +2,20 @@ import datetime
import html import html
import json import json
import os.path import os.path
from pathlib import Path
import gradio as gr import gradio as gr
from modules import generation_parameters_copypaste, images, sysinfo, errors 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: class UserMetadataEditor:
@ -98,6 +108,7 @@ class UserMetadataEditor:
stats = os.stat(filename) stats = os.stat(filename)
params = [ params = [
('Filename: ', os.path.basename(filename)), ('Filename: ', os.path.basename(filename)),
('Path: ', exclude_root_path(models_path, filename)),
('File size: ', sysinfo.pretty_bytes(stats.st_size)), ('File size: ', sysinfo.pretty_bytes(stats.st_size)),
('Hash: ', shorthash), ('Hash: ', shorthash),
('Modified: ', datetime.datetime.fromtimestamp(stats.st_mtime).strftime('%Y-%m-%d %H:%M')), ('Modified: ', datetime.datetime.fromtimestamp(stats.st_mtime).strftime('%Y-%m-%d %H:%M')),