Spaces:
Paused
Paused
lllyasviel
commited on
Commit
·
4567417
1
Parent(s):
df0d128
- modules/core.py +2 -2
- modules/cv2win32.py +4 -5
modules/core.py
CHANGED
@@ -82,9 +82,9 @@ def get_previewer(device, latent_format):
|
|
82 |
x_sample = x_sample.cpu().numpy().clip(0, 255).astype(np.uint8)
|
83 |
for i, s in enumerate(x_sample):
|
84 |
if i > 0:
|
85 |
-
show_preview(s, title=f'Preview Image {i}, step = [{step}/{total_steps}')
|
86 |
else:
|
87 |
-
show_preview(s, title=f'Preview Image, step = {step}/{total_steps}')
|
88 |
|
89 |
taesd.preview = preview_function
|
90 |
|
|
|
82 |
x_sample = x_sample.cpu().numpy().clip(0, 255).astype(np.uint8)
|
83 |
for i, s in enumerate(x_sample):
|
84 |
if i > 0:
|
85 |
+
show_preview(f'cv2_preview_{i}', s, title=f'Preview Image {i}, step = [{step}/{total_steps}')
|
86 |
else:
|
87 |
+
show_preview(f'cv2_preview_{i}', s, title=f'Preview Image, step = {step}/{total_steps}')
|
88 |
|
89 |
taesd.preview = preview_function
|
90 |
|
modules/cv2win32.py
CHANGED
@@ -2,12 +2,11 @@ import threading
|
|
2 |
import cv2
|
3 |
|
4 |
|
5 |
-
flag = 'fooocus_cv2win32'
|
6 |
buffer = []
|
7 |
|
8 |
|
9 |
def worker():
|
10 |
-
global buffer
|
11 |
while True:
|
12 |
cv2.waitKey(50)
|
13 |
try:
|
@@ -16,7 +15,7 @@ def worker():
|
|
16 |
if task is None:
|
17 |
cv2.destroyAllWindows()
|
18 |
else:
|
19 |
-
img, title = task
|
20 |
cv2.imshow(flag, img)
|
21 |
cv2.setWindowTitle(flag, title)
|
22 |
cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
|
@@ -25,8 +24,8 @@ def worker():
|
|
25 |
pass
|
26 |
|
27 |
|
28 |
-
def show_preview(img, title='preview'):
|
29 |
-
buffer.append((img, title))
|
30 |
|
31 |
|
32 |
def close_all_preview():
|
|
|
2 |
import cv2
|
3 |
|
4 |
|
|
|
5 |
buffer = []
|
6 |
|
7 |
|
8 |
def worker():
|
9 |
+
global buffer
|
10 |
while True:
|
11 |
cv2.waitKey(50)
|
12 |
try:
|
|
|
15 |
if task is None:
|
16 |
cv2.destroyAllWindows()
|
17 |
else:
|
18 |
+
flag, img, title = task
|
19 |
cv2.imshow(flag, img)
|
20 |
cv2.setWindowTitle(flag, title)
|
21 |
cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
|
|
|
24 |
pass
|
25 |
|
26 |
|
27 |
+
def show_preview(flag, img, title='preview'):
|
28 |
+
buffer.append((flag, img.copy(), title))
|
29 |
|
30 |
|
31 |
def close_all_preview():
|