Skip to content

Commit

Permalink
fix region regex
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Nov 5, 2023
1 parent 1af6a75 commit df8b4ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/onnx_web/diffusers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
INVERSION_TOKEN = compile(r"\<inversion:([^:\>]+):(-?[\.|\d]+)\>")
LORA_TOKEN = compile(r"\<lora:([^:\>]+):(-?[\.|\d]+)\>")
WILDCARD_TOKEN = compile(r"__([-/\\\w]+)__")
REGION_TOKEN = compile(r"\<region:(\d+):(\d+):(\d+):(\d+):(add|replace):([^\>]+)\>")
REGION_TOKEN = compile(r"\<region:(\d+):(\d+):(\d+):(\d+):(-?[\.|\d]+):([^\>]+)\>")

INTERVAL_RANGE = compile(r"(\w+)-{(\d+),(\d+)(?:,(\d+))?}")
ALTERNATIVE_RANGE = compile(r"\(([^\)]+)\)")
Expand Down Expand Up @@ -459,8 +459,8 @@ def slice_prompt(prompt: str, slice: int) -> str:


def parse_region_group(group) -> Region:
top, left, bottom, right, mode, prompt = group
return (int(top), int(left), int(bottom), int(right), float(mode), prompt)
top, left, bottom, right, mult, prompt = group
return (int(top), int(left), int(bottom), int(right), float(mult), prompt)


def parse_regions(prompt: str) -> Tuple[str, List[Region]]:
Expand Down
13 changes: 13 additions & 0 deletions run/onnx-web.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=onnx-web server
After=network.target

[Service]
Type=simple
# EnvironmentFile=/path/to/your/env
ExecStart=/opt/onnx-web/api/launch.sh
ExecStop=/bin/kill -WINCH ${MAINPID}
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target

0 comments on commit df8b4ab

Please sign in to comment.