Merge pull request #11660 from neilmahaseth/patch-1

Fix UnicodeEncodeError when writing to file CLIP Interrogator Batch Mode
This commit is contained in:
AUTOMATIC1111 2023-07-08 13:10:03 +03:00 committed by GitHub
commit 46c2b1e202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,7 +155,7 @@ def process_interrogate(interrogation_function, mode, ii_input_dir, ii_output_di
img = Image.open(image) img = Image.open(image)
filename = os.path.basename(image) filename = os.path.basename(image)
left, _ = os.path.splitext(filename) left, _ = os.path.splitext(filename)
print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a')) print(interrogation_function(img), file=open(os.path.join(ii_output_dir, f"{left}.txt"), 'a', encoding='utf-8'))
return [gr.update(), None] return [gr.update(), None]