mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-23 16:16:59 +08:00
Slightly rework the choices module interface.
This commit is contained in:
parent
9bc8b5ce44
commit
9aa915045a
@ -15,7 +15,7 @@ class LogicError(Exception):
|
|||||||
def get_seed():
|
def get_seed():
|
||||||
return int.from_bytes(os.urandom(8), byteorder='big')
|
return int.from_bytes(os.urandom(8), byteorder='big')
|
||||||
|
|
||||||
def translate_choices(text, seed=None):
|
def translate(text, seed=None):
|
||||||
'''
|
'''
|
||||||
Parses the text, translating "{A|B|C}" choices into a single choice.
|
Parses the text, translating "{A|B|C}" choices into a single choice.
|
||||||
An option is chosen randomly from the available options.
|
An option is chosen randomly from the available options.
|
||||||
|
|||||||
4
nodes.py
4
nodes.py
@ -14,7 +14,7 @@ from PIL.PngImagePlugin import PngInfo
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import safetensors.torch
|
import safetensors.torch
|
||||||
|
|
||||||
from comfy.choices import translate_choices
|
import comfy.choices
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "comfy"))
|
||||||
|
|
||||||
@ -1479,7 +1479,7 @@ class DynamicPrompt:
|
|||||||
CATEGORY = "conditioning"
|
CATEGORY = "conditioning"
|
||||||
|
|
||||||
def dynamic_prompt(self, text, seed):
|
def dynamic_prompt(self, text, seed):
|
||||||
translated_prompt_text = translate_choices(text, seed)
|
translated_prompt_text = comfy.choices.translate(text, seed)
|
||||||
return (translated_prompt_text,)
|
return (translated_prompt_text,)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user