Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#12838 from bluelovers/pr/file-metada…
Browse files Browse the repository at this point in the history
…ta-path-001

display file metadata `path` , `ss_output_name`
  • Loading branch information
AUTOMATIC1111 committed Aug 30, 2023
1 parent afea99a commit 3989d7e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions extensions-builtin/Lora/ui_edit_user_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def get_metadata_table(self, name):
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:",
Expand Down
11 changes: 11 additions & 0 deletions modules/ui_extra_networks_user_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@
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:
Expand Down Expand Up @@ -98,6 +108,7 @@ def get_metadata_table(self, name):
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')),
Expand Down

0 comments on commit 3989d7e

Please sign in to comment.