Skip to content

Commit

Permalink
chore: linting:
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed May 20, 2024
1 parent 744aafc commit df2966a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
7 changes: 6 additions & 1 deletion horde/apis/models/stable_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,12 @@ def __init__(self, api):
"tis": fields.List(fields.Nested(self.input_model_tis, skip_none=True)),
"special": fields.Nested(self.input_model_special_payload, skip_none=True),
"extra_texts": fields.List(fields.Nested(self.model_extra_texts)),
"workflow": fields.String(required=False, default=None, enum=list(KNOWN_WORKFLOWS), description="Explicitly specify the horde-engine workflow to use."),
"workflow": fields.String(
required=False,
default=None,
enum=list(KNOWN_WORKFLOWS),
description="Explicitly specify the horde-engine workflow to use.",
),
},
)
self.response_model_generation_payload = api.inherit(
Expand Down
4 changes: 2 additions & 2 deletions horde/apis/v2/stable.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from horde.logger import logger
from horde.model_reference import model_reference
from horde.patreon import patrons
from horde.utils import hash_dictionary, does_extra_text_reference_exist
from horde.utils import does_extra_text_reference_exist, hash_dictionary
from horde.vars import horde_title

models = ImageModels(api)
Expand Down Expand Up @@ -195,7 +195,7 @@ def validate(self):
raise e.BadRequest("QR Code controlnet only works with SD 1.5 models currently", rc="ControlNetMismatch.")
if self.params.get("extra_texts") is None or len(self.params.get("extra_texts")) == 0:
raise e.BadRequest("This request requires you pass the required extra texts for this workflow.", rc="MissingExtraTexts.")
if not does_extra_text_reference_exist(self.params.get("extra_texts"), 'qr_code'):
if not does_extra_text_reference_exist(self.params.get("extra_texts"), "qr_code"):
raise e.BadRequest("This request requires you pass the required extra texts for this workflow.", rc="MissingExtraTexts.")
if self.params.get("init_as_image") and self.params.get("return_control_map"):
raise e.UnsupportedModel(
Expand Down
4 changes: 1 addition & 3 deletions horde/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@
"lcm",
}

KNOWN_WORKFLOWS = {
"qr_code"
}
KNOWN_WORKFLOWS = {"qr_code"}

# These samplers perform double the steps per image
# As such we need to take it into account for the upfront kudos requirements
Expand Down
5 changes: 3 additions & 2 deletions horde/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ def validate_regex(regex_string):
return False
return True


def does_extra_text_reference_exist(extra_texts, reference):
for et in extra_texts:
if et['reference'] == reference:
if et["reference"] == reference:
return True
return False
return False

0 comments on commit df2966a

Please sign in to comment.