Slightly rework the choices module interface.

This commit is contained in:
Barry Downes 2023-08-05 13:33:56 +10:00
parent 9bc8b5ce44
commit 9aa915045a
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ class LogicError(Exception):
def get_seed():
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.
An option is chosen randomly from the available options.

View File

@ -14,7 +14,7 @@ from PIL.PngImagePlugin import PngInfo
import numpy as np
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"))
@ -1479,7 +1479,7 @@ class DynamicPrompt:
CATEGORY = "conditioning"
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,)