Fix various typos
This commit is contained in:
parent
685f9631b5
commit
c0355caefe
|
@ -83,7 +83,7 @@ Check the [custom scripts](https://github.com/AUTOMATIC1111/stable-diffusion-web
|
||||||
- Estimated completion time in progress bar
|
- Estimated completion time in progress bar
|
||||||
- API
|
- API
|
||||||
- Support for dedicated [inpainting model](https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion) by RunwayML.
|
- Support for dedicated [inpainting model](https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion) by RunwayML.
|
||||||
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
|
- via extension: [Aesthetic Gradients](https://github.com/AUTOMATIC1111/stable-diffusion-webui-aesthetic-gradients), a way to generate images with a specific aesthetic by using clip images embeds (implementation of [https://github.com/vicgalle/stable-diffusion-aesthetic-gradients](https://github.com/vicgalle/stable-diffusion-aesthetic-gradients))
|
||||||
- [Stable Diffusion 2.0](https://github.com/Stability-AI/stablediffusion) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#stable-diffusion-20) for instructions
|
- [Stable Diffusion 2.0](https://github.com/Stability-AI/stablediffusion) support - see [wiki](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#stable-diffusion-20) for instructions
|
||||||
|
|
||||||
## Installation and Running
|
## Installation and Running
|
||||||
|
|
|
@ -61,15 +61,15 @@ contextMenuInit = function(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendContextMenuOption(targetEmementSelector,entryName,entryFunction){
|
function appendContextMenuOption(targetElementSelector,entryName,entryFunction){
|
||||||
|
|
||||||
currentItems = menuSpecs.get(targetEmementSelector)
|
currentItems = menuSpecs.get(targetElementSelector)
|
||||||
|
|
||||||
if(!currentItems){
|
if(!currentItems){
|
||||||
currentItems = []
|
currentItems = []
|
||||||
menuSpecs.set(targetEmementSelector,currentItems);
|
menuSpecs.set(targetElementSelector,currentItems);
|
||||||
}
|
}
|
||||||
let newItem = {'id':targetEmementSelector+'_'+uid(),
|
let newItem = {'id':targetElementSelector+'_'+uid(),
|
||||||
'name':entryName,
|
'name':entryName,
|
||||||
'func':entryFunction,
|
'func':entryFunction,
|
||||||
'isNew':true}
|
'isNew':true}
|
||||||
|
|
|
@ -3,7 +3,7 @@ global_progressbars = {}
|
||||||
galleries = {}
|
galleries = {}
|
||||||
galleryObservers = {}
|
galleryObservers = {}
|
||||||
|
|
||||||
// this tracks laumnches of window.setTimeout for progressbar to prevent starting a new timeout when the previous is still running
|
// this tracks launches of window.setTimeout for progressbar to prevent starting a new timeout when the previous is still running
|
||||||
timeoutIds = {}
|
timeoutIds = {}
|
||||||
|
|
||||||
function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip, id_interrupt, id_preview, id_gallery){
|
function check_progressbar(id_part, id_progressbar, id_progressbar_span, id_skip, id_interrupt, id_preview, id_gallery){
|
||||||
|
|
|
@ -100,7 +100,7 @@ function create_submit_args(args){
|
||||||
|
|
||||||
// As it is currently, txt2img and img2img send back the previous output args (txt2img_gallery, generation_info, html_info) whenever you generate a new image.
|
// As it is currently, txt2img and img2img send back the previous output args (txt2img_gallery, generation_info, html_info) whenever you generate a new image.
|
||||||
// This can lead to uploading a huge gallery of previously generated images, which leads to an unnecessary delay between submitting and beginning to generate.
|
// This can lead to uploading a huge gallery of previously generated images, which leads to an unnecessary delay between submitting and beginning to generate.
|
||||||
// I don't know why gradio is seding outputs along with inputs, but we can prevent sending the image gallery here, which seems to be an issue for some.
|
// I don't know why gradio is sending outputs along with inputs, but we can prevent sending the image gallery here, which seems to be an issue for some.
|
||||||
// If gradio at some point stops sending outputs, this may break something
|
// If gradio at some point stops sending outputs, this may break something
|
||||||
if(Array.isArray(res[res.length - 3])){
|
if(Array.isArray(res[res.length - 3])){
|
||||||
res[res.length - 3] = null
|
res[res.length - 3] = null
|
||||||
|
|
|
@ -67,10 +67,10 @@ def encode_pil_to_base64(image):
|
||||||
class Api:
|
class Api:
|
||||||
def __init__(self, app: FastAPI, queue_lock: Lock):
|
def __init__(self, app: FastAPI, queue_lock: Lock):
|
||||||
if shared.cmd_opts.api_auth:
|
if shared.cmd_opts.api_auth:
|
||||||
self.credenticals = dict()
|
self.credentials = dict()
|
||||||
for auth in shared.cmd_opts.api_auth.split(","):
|
for auth in shared.cmd_opts.api_auth.split(","):
|
||||||
user, password = auth.split(":")
|
user, password = auth.split(":")
|
||||||
self.credenticals[user] = password
|
self.credentials[user] = password
|
||||||
|
|
||||||
self.router = APIRouter()
|
self.router = APIRouter()
|
||||||
self.app = app
|
self.app = app
|
||||||
|
@ -93,7 +93,7 @@ class Api:
|
||||||
self.add_api_route("/sdapi/v1/hypernetworks", self.get_hypernetworks, methods=["GET"], response_model=List[HypernetworkItem])
|
self.add_api_route("/sdapi/v1/hypernetworks", self.get_hypernetworks, methods=["GET"], response_model=List[HypernetworkItem])
|
||||||
self.add_api_route("/sdapi/v1/face-restorers", self.get_face_restorers, methods=["GET"], response_model=List[FaceRestorerItem])
|
self.add_api_route("/sdapi/v1/face-restorers", self.get_face_restorers, methods=["GET"], response_model=List[FaceRestorerItem])
|
||||||
self.add_api_route("/sdapi/v1/realesrgan-models", self.get_realesrgan_models, methods=["GET"], response_model=List[RealesrganItem])
|
self.add_api_route("/sdapi/v1/realesrgan-models", self.get_realesrgan_models, methods=["GET"], response_model=List[RealesrganItem])
|
||||||
self.add_api_route("/sdapi/v1/prompt-styles", self.get_promp_styles, methods=["GET"], response_model=List[PromptStyleItem])
|
self.add_api_route("/sdapi/v1/prompt-styles", self.get_prompt_styles, methods=["GET"], response_model=List[PromptStyleItem])
|
||||||
self.add_api_route("/sdapi/v1/artist-categories", self.get_artists_categories, methods=["GET"], response_model=List[str])
|
self.add_api_route("/sdapi/v1/artist-categories", self.get_artists_categories, methods=["GET"], response_model=List[str])
|
||||||
self.add_api_route("/sdapi/v1/artists", self.get_artists, methods=["GET"], response_model=List[ArtistItem])
|
self.add_api_route("/sdapi/v1/artists", self.get_artists, methods=["GET"], response_model=List[ArtistItem])
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ class Api:
|
||||||
return self.app.add_api_route(path, endpoint, dependencies=[Depends(self.auth)], **kwargs)
|
return self.app.add_api_route(path, endpoint, dependencies=[Depends(self.auth)], **kwargs)
|
||||||
return self.app.add_api_route(path, endpoint, **kwargs)
|
return self.app.add_api_route(path, endpoint, **kwargs)
|
||||||
|
|
||||||
def auth(self, credenticals: HTTPBasicCredentials = Depends(HTTPBasic())):
|
def auth(self, credentials: HTTPBasicCredentials = Depends(HTTPBasic())):
|
||||||
if credenticals.username in self.credenticals:
|
if credentials.username in self.credentials:
|
||||||
if compare_digest(credenticals.password, self.credenticals[credenticals.username]):
|
if compare_digest(credentials.password, self.credentials[credentials.username]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
raise HTTPException(status_code=401, detail="Incorrect username or password", headers={"WWW-Authenticate": "Basic"})
|
raise HTTPException(status_code=401, detail="Incorrect username or password", headers={"WWW-Authenticate": "Basic"})
|
||||||
|
@ -308,7 +308,7 @@ class Api:
|
||||||
def get_realesrgan_models(self):
|
def get_realesrgan_models(self):
|
||||||
return [{"name":x.name,"path":x.data_path, "scale":x.scale} for x in get_realesrgan_models(None)]
|
return [{"name":x.name,"path":x.data_path, "scale":x.scale} for x in get_realesrgan_models(None)]
|
||||||
|
|
||||||
def get_promp_styles(self):
|
def get_prompt_styles(self):
|
||||||
styleList = []
|
styleList = []
|
||||||
for k in shared.prompt_styles.styles:
|
for k in shared.prompt_styles.styles:
|
||||||
style = shared.prompt_styles.styles[k]
|
style = shared.prompt_styles.styles[k]
|
||||||
|
|
|
@ -128,7 +128,7 @@ class ExtrasBaseRequest(BaseModel):
|
||||||
upscaling_resize: float = Field(default=2, title="Upscaling Factor", ge=1, le=4, description="By how much to upscale the image, only used when resize_mode=0.")
|
upscaling_resize: float = Field(default=2, title="Upscaling Factor", ge=1, le=4, description="By how much to upscale the image, only used when resize_mode=0.")
|
||||||
upscaling_resize_w: int = Field(default=512, title="Target Width", ge=1, description="Target width for the upscaler to hit. Only used when resize_mode=1.")
|
upscaling_resize_w: int = Field(default=512, title="Target Width", ge=1, description="Target width for the upscaler to hit. Only used when resize_mode=1.")
|
||||||
upscaling_resize_h: int = Field(default=512, title="Target Height", ge=1, description="Target height for the upscaler to hit. Only used when resize_mode=1.")
|
upscaling_resize_h: int = Field(default=512, title="Target Height", ge=1, description="Target height for the upscaler to hit. Only used when resize_mode=1.")
|
||||||
upscaling_crop: bool = Field(default=True, title="Crop to fit", description="Should the upscaler crop the image to fit in the choosen size?")
|
upscaling_crop: bool = Field(default=True, title="Crop to fit", description="Should the upscaler crop the image to fit in the chosen size?")
|
||||||
upscaler_1: str = Field(default="None", title="Main upscaler", description=f"The name of the main upscaler to use, it has to be one of this list: {' , '.join([x.name for x in sd_upscalers])}")
|
upscaler_1: str = Field(default="None", title="Main upscaler", description=f"The name of the main upscaler to use, it has to be one of this list: {' , '.join([x.name for x in sd_upscalers])}")
|
||||||
upscaler_2: str = Field(default="None", title="Secondary upscaler", description=f"The name of the secondary upscaler to use, it has to be one of this list: {' , '.join([x.name for x in sd_upscalers])}")
|
upscaler_2: str = Field(default="None", title="Secondary upscaler", description=f"The name of the secondary upscaler to use, it has to be one of this list: {' , '.join([x.name for x in sd_upscalers])}")
|
||||||
extras_upscaler_2_visibility: float = Field(default=0, title="Secondary upscaler visibility", ge=0, le=1, allow_inf_nan=False, description="Sets the visibility of secondary upscaler, values should be between 0 and 1.")
|
extras_upscaler_2_visibility: float = Field(default=0, title="Secondary upscaler visibility", ge=0, le=1, allow_inf_nan=False, description="Sets the visibility of secondary upscaler, values should be between 0 and 1.")
|
||||||
|
|
|
@ -590,7 +590,7 @@ def read_info_from_image(image):
|
||||||
Negative prompt: {json_info["uc"]}
|
Negative prompt: {json_info["uc"]}
|
||||||
Steps: {json_info["steps"]}, Sampler: {sampler}, CFG scale: {json_info["scale"]}, Seed: {json_info["seed"]}, Size: {image.width}x{image.height}, Clip skip: 2, ENSD: 31337"""
|
Steps: {json_info["steps"]}, Sampler: {sampler}, CFG scale: {json_info["scale"]}, Seed: {json_info["seed"]}, Size: {image.width}x{image.height}, Clip skip: 2, ENSD: 31337"""
|
||||||
except Exception:
|
except Exception:
|
||||||
print(f"Error parsing NovelAI iamge generation parameters:", file=sys.stderr)
|
print(f"Error parsing NovelAI image generation parameters:", file=sys.stderr)
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
|
||||||
return geninfo, items
|
return geninfo, items
|
||||||
|
|
|
@ -704,7 +704,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
|
||||||
|
|
||||||
samples = samples[:, :, self.truncate_y//2:samples.shape[2]-self.truncate_y//2, self.truncate_x//2:samples.shape[3]-self.truncate_x//2]
|
samples = samples[:, :, self.truncate_y//2:samples.shape[2]-self.truncate_y//2, self.truncate_x//2:samples.shape[3]-self.truncate_x//2]
|
||||||
|
|
||||||
"""saves image before applying hires fix, if enabled in options; takes as an arguyment either an image or batch with latent space images"""
|
"""saves image before applying hires fix, if enabled in options; takes as an argument either an image or batch with latent space images"""
|
||||||
def save_intermediate(image, index):
|
def save_intermediate(image, index):
|
||||||
if not opts.save or self.do_not_save_samples or not opts.save_images_before_highres_fix:
|
if not opts.save or self.do_not_save_samples or not opts.save_images_before_highres_fix:
|
||||||
return
|
return
|
||||||
|
|
|
@ -108,7 +108,7 @@ def load(filename, *args, **kwargs):
|
||||||
|
|
||||||
def load_with_extra(filename, extra_handler=None, *args, **kwargs):
|
def load_with_extra(filename, extra_handler=None, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
this functon is intended to be used by extensions that want to load models with
|
this function is intended to be used by extensions that want to load models with
|
||||||
some extra classes in them that the usual unpickler would find suspicious.
|
some extra classes in them that the usual unpickler would find suspicious.
|
||||||
|
|
||||||
Use the extra_handler argument to specify a function that takes module and field name as text,
|
Use the extra_handler argument to specify a function that takes module and field name as text,
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Script:
|
||||||
def ui(self, is_img2img):
|
def ui(self, is_img2img):
|
||||||
"""this function should create gradio UI elements. See https://gradio.app/docs/#components
|
"""this function should create gradio UI elements. See https://gradio.app/docs/#components
|
||||||
The return value should be an array of all components that are used in processing.
|
The return value should be an array of all components that are used in processing.
|
||||||
Values of those returned componenbts will be passed to run() and process() functions.
|
Values of those returned components will be passed to run() and process() functions.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
@ -47,7 +47,7 @@ class Script:
|
||||||
|
|
||||||
This function should return:
|
This function should return:
|
||||||
- False if the script should not be shown in UI at all
|
- False if the script should not be shown in UI at all
|
||||||
- True if the script should be shown in UI if it's scelected in the scripts drowpdown
|
- True if the script should be shown in UI if it's selected in the scripts dropdown
|
||||||
- script.AlwaysVisible if the script should be shown in UI at all times
|
- script.AlwaysVisible if the script should be shown in UI at all times
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -326,7 +326,7 @@ def do_inpainting_hijack():
|
||||||
# most of this stuff seems to no longer be needed because it is already included into SD2.0
|
# most of this stuff seems to no longer be needed because it is already included into SD2.0
|
||||||
# LatentInpaintDiffusion remains because SD2.0's LatentInpaintDiffusion can't be loaded without specifying a checkpoint
|
# LatentInpaintDiffusion remains because SD2.0's LatentInpaintDiffusion can't be loaded without specifying a checkpoint
|
||||||
# p_sample_plms is needed because PLMS can't work with dicts as conditionings
|
# p_sample_plms is needed because PLMS can't work with dicts as conditionings
|
||||||
# this file should be cleaned up later if weverything tuens out to work fine
|
# this file should be cleaned up later if everything turns out to work fine
|
||||||
|
|
||||||
# ldm.models.diffusion.ddpm.get_unconditional_conditioning = get_unconditional_conditioning
|
# ldm.models.diffusion.ddpm.get_unconditional_conditioning = get_unconditional_conditioning
|
||||||
ldm.models.diffusion.ddpm.LatentInpaintDiffusion = LatentInpaintDiffusion
|
ldm.models.diffusion.ddpm.LatentInpaintDiffusion = LatentInpaintDiffusion
|
||||||
|
|
|
@ -4,7 +4,7 @@ import torch
|
||||||
class TorchHijackForUnet:
|
class TorchHijackForUnet:
|
||||||
"""
|
"""
|
||||||
This is torch, but with cat that resizes tensors to appropriate dimensions if they do not match;
|
This is torch, but with cat that resizes tensors to appropriate dimensions if they do not match;
|
||||||
this makes it possible to create pictures with dimensions that are muliples of 8 rather than 64
|
this makes it possible to create pictures with dimensions that are multiples of 8 rather than 64
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __getattr__(self, item):
|
def __getattr__(self, item):
|
||||||
|
|
|
@ -57,7 +57,7 @@ class PersonalizedBase(Dataset):
|
||||||
print("Preparing dataset...")
|
print("Preparing dataset...")
|
||||||
for path in tqdm.tqdm(self.image_paths):
|
for path in tqdm.tqdm(self.image_paths):
|
||||||
if shared.state.interrupted:
|
if shared.state.interrupted:
|
||||||
raise Exception("inturrupted")
|
raise Exception("interrupted")
|
||||||
try:
|
try:
|
||||||
image = Image.open(path).convert('RGB').resize((self.width, self.height), PIL.Image.BICUBIC)
|
image = Image.open(path).convert('RGB').resize((self.width, self.height), PIL.Image.BICUBIC)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -133,7 +133,7 @@ class EmbeddingDatabase:
|
||||||
|
|
||||||
process_file(fullfn, fn)
|
process_file(fullfn, fn)
|
||||||
except Exception:
|
except Exception:
|
||||||
print(f"Error loading emedding {fn}:", file=sys.stderr)
|
print(f"Error loading embedding {fn}:", file=sys.stderr)
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ def draw_xy_grid(xs, ys, x_label, y_label, cell):
|
||||||
ver_texts = [[images.GridAnnotation(y_label(y))] for y in ys]
|
ver_texts = [[images.GridAnnotation(y_label(y))] for y in ys]
|
||||||
hor_texts = [[images.GridAnnotation(x_label(x))] for x in xs]
|
hor_texts = [[images.GridAnnotation(x_label(x))] for x in xs]
|
||||||
|
|
||||||
first_pocessed = None
|
first_processed = None
|
||||||
|
|
||||||
state.job_count = len(xs) * len(ys)
|
state.job_count = len(xs) * len(ys)
|
||||||
|
|
||||||
|
@ -27,17 +27,17 @@ def draw_xy_grid(xs, ys, x_label, y_label, cell):
|
||||||
state.job = f"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
|
state.job = f"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
|
||||||
|
|
||||||
processed = cell(x, y)
|
processed = cell(x, y)
|
||||||
if first_pocessed is None:
|
if first_processed is None:
|
||||||
first_pocessed = processed
|
first_processed = processed
|
||||||
|
|
||||||
res.append(processed.images[0])
|
res.append(processed.images[0])
|
||||||
|
|
||||||
grid = images.image_grid(res, rows=len(ys))
|
grid = images.image_grid(res, rows=len(ys))
|
||||||
grid = images.draw_grid_annotations(grid, res[0].width, res[0].height, hor_texts, ver_texts)
|
grid = images.draw_grid_annotations(grid, res[0].width, res[0].height, hor_texts, ver_texts)
|
||||||
|
|
||||||
first_pocessed.images = [grid]
|
first_processed.images = [grid]
|
||||||
|
|
||||||
return first_pocessed
|
return first_processed
|
||||||
|
|
||||||
|
|
||||||
class Script(scripts.Script):
|
class Script(scripts.Script):
|
||||||
|
|
4
webui.py
4
webui.py
|
@ -153,8 +153,8 @@ def webui():
|
||||||
|
|
||||||
# gradio uses a very open CORS policy via app.user_middleware, which makes it possible for
|
# gradio uses a very open CORS policy via app.user_middleware, which makes it possible for
|
||||||
# an attacker to trick the user into opening a malicious HTML page, which makes a request to the
|
# an attacker to trick the user into opening a malicious HTML page, which makes a request to the
|
||||||
# running web ui and do whatever the attcker wants, including installing an extension and
|
# running web ui and do whatever the attacker wants, including installing an extension and
|
||||||
# runnnig its code. We disable this here. Suggested by RyotaK.
|
# running its code. We disable this here. Suggested by RyotaK.
|
||||||
app.user_middleware = [x for x in app.user_middleware if x.cls.__name__ != 'CORSMiddleware']
|
app.user_middleware = [x for x in app.user_middleware if x.cls.__name__ != 'CORSMiddleware']
|
||||||
|
|
||||||
setup_cors(app)
|
setup_cors(app)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user