Skip to content

Commit

Permalink
允许在sdwebui配置中添加alwayson_scripts
Browse files Browse the repository at this point in the history
如:
[sdwebui.alwayson_scripts.ADetailer]
args = [{ad_model = "face_yolov8n.pt"},{ad_model = "hand_yolov8n.pt"}]
  • Loading branch information
TNTcraftHIM authored and lss233 committed Mar 3, 2024
1 parent 7a27f4a commit 0aa5b69
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ class Ratelimit(BaseModel):


class SDWebUI(BaseModel):
class ScriptArg(BaseModel):
ad_model: str

class ScriptConfig(BaseModel):
args: List['SDWebUI.ScriptArg']

api_url: str
"""API 基地址,如:http://127.0.0.1:7890"""
prompt_prefix: str = 'masterpiece, best quality, illustration, extremely detailed 8K wallpaper'
Expand All @@ -534,13 +540,16 @@ class SDWebUI(BaseModel):
cfg_scale: float = 7.5
restore_faces: bool = False
authorization: str = ''
alwayson_scripts: Dict[str, 'SDWebUI.ScriptConfig'] = {}
"""登录api的账号:密码"""

timeout: float = 10.0
"""超时时间"""

class Config(BaseConfig):
extra = Extra.allow
SDWebUI.update_forward_refs()
SDWebUI.ScriptConfig.update_forward_refs()


class Config(BaseModel):
Expand Down
3 changes: 2 additions & 1 deletion drawing/sdwebui.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ async def text_to_img(self, prompt):
'tiling': 'false',
'negative_prompt': config.sdwebui.negative_prompt,
'eta': 0,
'sampler_index': config.sdwebui.sampler_index
'sampler_index': config.sdwebui.sampler_index,
'alwayson_scripts': {}
}

for key, value in config.sdwebui.dict(exclude_none=True).items():
Expand Down

0 comments on commit 0aa5b69

Please sign in to comment.