Commit
·
0f49e30
1
Parent(s):
898faaf
Refactor field validation in models.py
Browse files- tabs/images/models.py +16 -16
tabs/images/models.py
CHANGED
@@ -39,22 +39,22 @@ class BaseReq(BaseModel):
|
|
39 |
class Config:
|
40 |
arbitrary_types_allowed = True
|
41 |
|
42 |
-
@field_validator('model', 'negative_prompt', 'embeddings', 'clip_skip', 'controlnet_config', mode='before')
|
43 |
-
def check_model(cls, values):
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
|
59 |
|
60 |
class BaseImg2ImgReq(BaseReq):
|
|
|
39 |
class Config:
|
40 |
arbitrary_types_allowed = True
|
41 |
|
42 |
+
# @field_validator('model', 'negative_prompt', 'embeddings', 'clip_skip', 'controlnet_config', mode='before')
|
43 |
+
# def check_model(cls, values):
|
44 |
+
# for m in appConfig.IMAGES_MODELS:
|
45 |
+
# if isinstance(m, dict) and m.get('repo_id') == values.get('model'):
|
46 |
+
# loader = m.get('loader')
|
47 |
+
|
48 |
+
# if loader == "flux" and values.get('negative_prompt'):
|
49 |
+
# raise ValueError("Negative prompt is not supported for Flux models.")
|
50 |
+
# if loader == "flux" and values.get('embeddings'):
|
51 |
+
# raise ValueError("Embeddings are not supported for Flux models.")
|
52 |
+
# if loader == "flux" and values.get('clip_skip'):
|
53 |
+
# raise ValueError("Clip skip is not supported for Flux models.")
|
54 |
+
# if loader == "flux" and values.get('controlnet_config'):
|
55 |
+
# if "scribble" in values.get('controlnet_config').controlnets:
|
56 |
+
# raise ValueError("Scribble is not supported for Flux models.")
|
57 |
+
# return values
|
58 |
|
59 |
|
60 |
class BaseImg2ImgReq(BaseReq):
|