1.0.16 (#19)
### 1.0.16 * Implemented "output" folder for saving user results. * Ignored cv2 errors when preview fails. * Mentioned future AMD support in Readme. * Created this log.
This commit is contained in:
parent
712ced1248
commit
6d406da4a4
|
|
@ -1,2 +1,2 @@
|
|||
version = '1.0.15'
|
||||
version = '1.0.16'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import threading
|
||||
import cv2
|
||||
import os
|
||||
|
||||
|
||||
buffer = []
|
||||
|
|
@ -7,9 +8,9 @@ buffer = []
|
|||
|
||||
def worker():
|
||||
global buffer
|
||||
while True:
|
||||
cv2.waitKey(50)
|
||||
try:
|
||||
try:
|
||||
while True:
|
||||
cv2.waitKey(50)
|
||||
if len(buffer) > 0:
|
||||
task = buffer.pop(0)
|
||||
if task is None:
|
||||
|
|
@ -19,11 +20,18 @@ def worker():
|
|||
cv2.imshow(flag, img)
|
||||
cv2.setWindowTitle(flag, title)
|
||||
cv2.setWindowProperty(flag, cv2.WND_PROP_TOPMOST, 1)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except Exception as e:
|
||||
print('Failed to open preview window. You are not using a local device with GUI support.')
|
||||
print(e)
|
||||
pass
|
||||
|
||||
|
||||
def save_image(path, img):
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
cv2.imwrite(path, img[..., ::-1].copy())
|
||||
print(f'Image saved: {path}')
|
||||
|
||||
|
||||
def show_preview(flag, img, title='preview'):
|
||||
buffer.append((flag, img[..., ::-1].copy(), title))
|
||||
|
||||
|
|
|
|||
|
|
@ -2,3 +2,6 @@ import os
|
|||
|
||||
modelfile_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../models/checkpoints/'))
|
||||
lorafile_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../models/loras/'))
|
||||
temp_outputs_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../outputs/'))
|
||||
|
||||
os.makedirs(temp_outputs_path, exist_ok=True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
import datetime
|
||||
import random
|
||||
import os
|
||||
|
||||
|
||||
def generate_temp_filename(folder='./outputs/', extension='png'):
|
||||
current_time = datetime.datetime.now()
|
||||
date_string = current_time.strftime("%Y-%m-%d")
|
||||
time_string = current_time.strftime("%Y-%m-%d_%H-%M-%S")
|
||||
random_number = random.randint(1000, 9999)
|
||||
filename = f"{time_string}_{random_number}.{extension}"
|
||||
result = os.path.join(folder, date_string, filename)
|
||||
return os.path.abspath(os.path.realpath(result))
|
||||
|
|
@ -34,7 +34,7 @@ In the first time you launch the software, it will automatically download models
|
|||
|
||||
If you already have these files, you can copy them to the above locations to speed up installation.
|
||||
|
||||
### Linux and Mac
|
||||
### Linux/Mac/Windows(AMD GPUs)
|
||||
|
||||
Coming soon ...
|
||||
|
||||
|
|
@ -57,3 +57,7 @@ Note that some of these tricks are currently (2023 Aug 11) impossible to reprodu
|
|||
## Thanks
|
||||
|
||||
The codebase starts from an odd mixture of [Automatic1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui) and [ComfyUI](https://github.com/comfyanonymous/ComfyUI). (And they both use GPL license.)
|
||||
|
||||
## Update Log
|
||||
|
||||
The log is [here](update_log.md).
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
### 1.0.16
|
||||
|
||||
* Implemented "output" folder for saving user results.
|
||||
* Ignored cv2 errors when preview fails.
|
||||
* Mentioned future AMD support in Readme.
|
||||
* Created this log.
|
||||
|
||||
### 1.0.15
|
||||
|
||||
Publicly available.
|
||||
|
||||
### 1.0.0
|
||||
|
||||
Initial Version.
|
||||
9
webui.py
9
webui.py
|
|
@ -4,7 +4,9 @@ import fooocus_version
|
|||
|
||||
from modules.sdxl_styles import apply_style, style_keys, aspect_ratios
|
||||
from modules.default_pipeline import process
|
||||
from modules.cv2win32 import close_all_preview
|
||||
from modules.cv2win32 import close_all_preview, save_image
|
||||
from modules.util import generate_temp_filename
|
||||
from modules.path import temp_outputs_path
|
||||
|
||||
|
||||
def generate_clicked(prompt, negative_prompt, style_selction, performance_selction,
|
||||
|
|
@ -34,6 +36,11 @@ def generate_clicked(prompt, negative_prompt, style_selction, performance_selcti
|
|||
|
||||
for i in range(image_number):
|
||||
imgs = process(p_txt, n_txt, steps, switch, width, height, seed, callback=callback)
|
||||
|
||||
for x in imgs:
|
||||
local_temp_filename = generate_temp_filename(folder=temp_outputs_path, extension='png')
|
||||
save_image(local_temp_filename, x)
|
||||
|
||||
seed += 1
|
||||
results += imgs
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue