mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update prompt.py
Use UTF-8 encoding on reading prompts from files to allow Unicode characters to load correctly. The following examples currently will not load correctly from a file: Hello, 世界! 😭🤮 💔
This commit is contained in:
parent
b0fe57ec80
commit
2a087bf161
@ -82,7 +82,7 @@ class PromptsFromFileInvocation(BaseInvocation):
|
||||
end_line = start_line + max_prompts
|
||||
if max_prompts <= 0:
|
||||
end_line = np.iinfo(np.int32).max
|
||||
with open(file_path) as f:
|
||||
with open(file_path, encoding="utf-8") as f:
|
||||
for i, line in enumerate(f):
|
||||
if i >= start_line and i < end_line:
|
||||
prompts.append((pre_prompt or "") + line.strip() + (post_prompt or ""))
|
||||
|
Loading…
Reference in New Issue
Block a user