lllyasviel commited on
Commit
7ccee96
1 Parent(s): 9a534a8

1.0.32 (#158)

Browse files

Fooocus private log

fooocus_version.py CHANGED
@@ -1 +1 @@
1
- version = '1.0.31'
 
1
+ version = '1.0.32'
modules/async_worker.py CHANGED
@@ -8,7 +8,6 @@ outputs = []
8
  def worker():
9
  global buffer, outputs
10
 
11
- import os
12
  import time
13
  import shared
14
  import random
@@ -16,9 +15,8 @@ def worker():
16
  import modules.path
17
  import modules.patch
18
 
19
- from PIL import Image
20
  from modules.sdxl_styles import apply_style, aspect_ratios
21
- from modules.util import generate_temp_filename
22
 
23
  try:
24
  async_gradio_app = shared.gradio_root
@@ -72,9 +70,20 @@ def worker():
72
  imgs = pipeline.process(p_txt, n_txt, steps, switch, width, height, seed, callback=callback)
73
 
74
  for x in imgs:
75
- local_temp_filename = generate_temp_filename(folder=modules.path.temp_outputs_path, extension='png')
76
- os.makedirs(os.path.dirname(local_temp_filename), exist_ok=True)
77
- Image.fromarray(x).save(local_temp_filename)
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  seed += 1
80
  results += imgs
 
8
  def worker():
9
  global buffer, outputs
10
 
 
11
  import time
12
  import shared
13
  import random
 
15
  import modules.path
16
  import modules.patch
17
 
 
18
  from modules.sdxl_styles import apply_style, aspect_ratios
19
+ from modules.private_logger import log
20
 
21
  try:
22
  async_gradio_app = shared.gradio_root
 
70
  imgs = pipeline.process(p_txt, n_txt, steps, switch, width, height, seed, callback=callback)
71
 
72
  for x in imgs:
73
+ d = [
74
+ ('Prompt', prompt),
75
+ ('Negative Prompt', negative_prompt),
76
+ ('Style', style_selction),
77
+ ('Performance', performance_selction),
78
+ ('Resolution', aspect_ratios_selction),
79
+ ('Sharpness', sharpness),
80
+ ('Base Model', base_model_name),
81
+ ('Refiner Model', refiner_model_name),
82
+ ]
83
+ for n, w in loras:
84
+ if n != 'None':
85
+ d.append((f'Lora [{n}] weight', w))
86
+ log(x, d)
87
 
88
  seed += 1
89
  results += imgs
modules/private_logger.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import modules.path
3
+
4
+ from PIL import Image
5
+ from modules.util import generate_temp_filename
6
+
7
+
8
+ def log(img, dic):
9
+ date_string, local_temp_filename, only_name = generate_temp_filename(folder=modules.path.temp_outputs_path, extension='png')
10
+ os.makedirs(os.path.dirname(local_temp_filename), exist_ok=True)
11
+ Image.fromarray(img).save(local_temp_filename)
12
+ html_name = os.path.join(os.path.dirname(local_temp_filename), 'log.html')
13
+
14
+ if not os.path.exists(html_name):
15
+ with open(html_name, 'a+') as f:
16
+ f.write(f"<p>Fooocus Log {date_string} (private)</p>\n")
17
+ f.write(f"<p>All images do not contain any hidden data.</p>")
18
+
19
+ with open(html_name, 'a+') as f:
20
+ f.write(f"<hr>\n")
21
+ f.write(f"<p>{only_name}</p>\n")
22
+ i = 0
23
+ for k, v in dic:
24
+ if i < 2:
25
+ f.write(f"<p>{k}: <b>{v}</b> </p>\n")
26
+ else:
27
+ if i % 2 == 0:
28
+ f.write(f"<p>{k}: <b>{v}</b>, ")
29
+ else:
30
+ f.write(f"{k}: <b>{v}</b></p>\n")
31
+ i += 1
32
+ f.write(f"<p><img src=\"{local_temp_filename}\" width=512></img></p>\n")
33
+
34
+ print(f'Image generated with private log at: {html_name}')
35
+
36
+ return
modules/util.py CHANGED
@@ -10,4 +10,4 @@ def generate_temp_filename(folder='./outputs/', extension='png'):
10
  random_number = random.randint(1000, 9999)
11
  filename = f"{time_string}_{random_number}.{extension}"
12
  result = os.path.join(folder, date_string, filename)
13
- return os.path.abspath(os.path.realpath(result))
 
10
  random_number = random.randint(1000, 9999)
11
  filename = f"{time_string}_{random_number}.{extension}"
12
  result = os.path.join(folder, date_string, filename)
13
+ return date_string, os.path.abspath(os.path.realpath(result)), filename
update_log.md CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  ### 1.0.31
2
 
3
  * Fix typo and UI.
 
1
+ ### 1.0.32
2
+
3
+ * Fooocus private log
4
+
5
  ### 1.0.31
6
 
7
  * Fix typo and UI.