mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-07 14:12:53 +08:00
Revert "Offloading custom work"
This reverts commit f3d1631aab
.
This work has been offloaded now into an extension called Prompt Control.
This commit is contained in:
parent
f3d1631aab
commit
8f3b02f095
@ -1,29 +0,0 @@
|
|||||||
import os
|
|
||||||
import gc
|
|
||||||
import re
|
|
||||||
|
|
||||||
import modules.paths as paths
|
|
||||||
|
|
||||||
class CustomStatics:
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
# loads a file with strings structured as below, on each line with a : between the search and replace strings, into a list
|
|
||||||
# search0:replace0
|
|
||||||
# search string:replace string
|
|
||||||
#
|
|
||||||
# Then replaces all occurrences of the list's search strings with the list's replace strings in one go
|
|
||||||
def mass_replace_strings(input_string):
|
|
||||||
with open(os.path.join(paths.data_path, "custom_statics/Replacements.txt"), "r", encoding="utf8") as file:
|
|
||||||
replacements = file.readlines()
|
|
||||||
|
|
||||||
replacement_dict = {}
|
|
||||||
for line in replacements:
|
|
||||||
search, replace = line.strip().split(":")
|
|
||||||
replacement_dict[search] = replace
|
|
||||||
|
|
||||||
def replace(match_text):
|
|
||||||
return replacement_dict[match_text.group(0)]
|
|
||||||
|
|
||||||
return re.sub('|'.join(r'\b%s\b' % re.escape(s) for s in replacement_dict.keys()), replace, str(input_string))
|
|
||||||
|
|
||||||
return str(geninfo)
|
|
@ -370,14 +370,6 @@ def connect_paste(button, paste_fields, input_comp, override_settings_component,
|
|||||||
prompt = file.read()
|
prompt = file.read()
|
||||||
|
|
||||||
params = parse_generation_parameters(prompt)
|
params = parse_generation_parameters(prompt)
|
||||||
|
|
||||||
# This sanitizes unsavory prompt words when copying from another image
|
|
||||||
# for my own sanity. This is not intended to be contributed to the main repo,
|
|
||||||
# it's just so I don't have to see anything I'm not interested in when batch
|
|
||||||
# reproducing images from civit.ai or elsewhere when working on loras
|
|
||||||
# todo: make this work with the callback instead of forcing it here, this can be an extension when I feel like putting it together :D
|
|
||||||
from modules import custom_statics
|
|
||||||
params = custom_statics.CustomStatics.mass_replace_strings(params)
|
|
||||||
script_callbacks.infotext_pasted_callback(prompt, params)
|
script_callbacks.infotext_pasted_callback(prompt, params)
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
@echo off
|
@echo off
|
||||||
set TEMP=G:\SD-temp
|
|
||||||
set PYTHON=
|
set PYTHON=
|
||||||
set GIT=
|
set GIT=
|
||||||
set VENV_DIR=
|
set VENV_DIR=
|
||||||
set COMMANDLINE_ARGS= --xformers
|
set COMMANDLINE_ARGS=
|
||||||
|
|
||||||
call webui.bat
|
call webui.bat
|
||||||
|
Loading…
Reference in New Issue
Block a user