import os import modules.path from PIL import Image from modules.util import generate_temp_filename def log(img, dic): date_string, local_temp_filename, only_name = generate_temp_filename(folder=modules.path.temp_outputs_path, extension='png') os.makedirs(os.path.dirname(local_temp_filename), exist_ok=True) Image.fromarray(img).save(local_temp_filename) html_name = os.path.join(os.path.dirname(local_temp_filename), 'log.html') if not os.path.exists(html_name): with open(html_name, 'a+', encoding='utf-8') as f: f.write(f"
Fooocus Log {date_string} (private)
\n") f.write(f"All images do not contain any hidden data.
") with open(html_name, 'a+', encoding='utf-8') as f: div_name = only_name.replace('.', '_') f.write(f'{only_name}
\n") i = 0 for k, v in dic: if i < 2: f.write(f"{k}: {v}
\n") else: if i % 2 == 0: f.write(f"{k}: {v}, ") else: f.write(f"{k}: {v}
\n") i += 1 f.write(f"