Skip to content

Commit

Permalink
fix(api): replace unknown wildcards with empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jul 4, 2023
1 parent c8a9dd4 commit fa3a36e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/onnx_web/diffusers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,11 @@ def replace_wildcards(prompt: str, seed: int, wildcards: Dict[str, List[str]]) -
logger.debug("found wildcard in prompt: %s", next_match)
name = next_match.groups()

if name not in wildcards:
wildcard = ""
if name in wildcards:
wildcard = random.choice(wildcards.get(name))
else:
logger.warning("unknown wildcard: %s", name)
continue

wildcard = random.choice(wildcards.get(name))

remaining_prompt = (
remaining_prompt[: next_match.start()]
Expand Down

0 comments on commit fa3a36e

Please sign in to comment.