From fd8322e2151442935e744a5a4e43c048175f9ad2 Mon Sep 17 00:00:00 2001 From: Luke Robles Date: Thu, 14 Sep 2023 09:37:15 -0700 Subject: [PATCH] adding upscaling --- app/cogs/stable_diffusion.py | 5 ++++- app/stable_diffusion.py | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/cogs/stable_diffusion.py b/app/cogs/stable_diffusion.py index 7dc89d5d..89c338c4 100755 --- a/app/cogs/stable_diffusion.py +++ b/app/cogs/stable_diffusion.py @@ -38,14 +38,16 @@ class StableDiffusion(commands.Cog): # Everyone can use my gaming computer temporarily ip = "192.168.1.19" steps = 50 + enable_upscale = "false" # Send my requests to my gaming computer with the 3080 (if its up) if ctx.author.id == core_utils.my_id: ip = "192.168.1.19" positive_prompt = ( positive_prompt - + " " + + " " ) + enable_upscale = "true" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) try: @@ -64,6 +66,7 @@ class StableDiffusion(commands.Cog): negatives=negative_prompt or "(bad-image-v2-39000:0.8), (bad_prompt_version2:0.8), (bad-hands-5:1.1), (EasyNegative:0.8), (NG_DeepNegative_V1_4T:0.8), (bad-artist-anime:0.7),(deformed iris, deformed pupils, bad eyes, semi-realistic:1.4), (worst quality, low quality:1.3), (blurry:1.2), (greyscale, monochrome:1.1), (poorly drawn face), cloned face, cross eyed , extra fingers, mutated hands, (fused fingers), (too many fingers), (missing arms), (missing legs), (extra arms), (extra legs), (poorly drawn hands), (bad anatomy), (bad proportions), cropped, lowres, text, jpeg artifacts, signature, watermark, username, artist name, trademark, watermark, title, multiple view, Reference sheet, long neck, Out of Frame, B&W, logo, Watermark, bad artist, blur, blurry, text, b&w, 3d, bad art, poorly drawn, disfigured, deformed, extra limbs, ugly hands, extra fingers, canvas frame, cartoon, 3d, disfigured, bad art, deformed, extra limbs, weird colors, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, ugly, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, out of frame, ugly, extra limbs, bad anatomy, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, mutated hands, fused fingers, too many fingers, long neck, Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eye, body out of frame, bad art, bad anatomy, 3d render", steps=steps, + enable_upscale=enable_upscale, ) await original_message.edit( file=discord.File( diff --git a/app/stable_diffusion.py b/app/stable_diffusion.py index 04de643c..f782565f 100755 --- a/app/stable_diffusion.py +++ b/app/stable_diffusion.py @@ -4,14 +4,19 @@ import httpx import tempfile -async def generate_image(ip, port, positives, negatives, steps): +async def generate_image(ip, port, positives, negatives, steps, enable_upscale): url = "http://" + ip + ":" + port + "/sdapi/v1/txt2img" json_data = { "prompt": positives, "negative_prompt": negatives, "steps": steps, - "hr_upscale": 2, + "enable_hr": enable_upscale, + "hr_upscaler": "Latent", + "hr_second_pass_steps": 20, + "denoising_strength": 0.5, + "hr_resize_x": 1024, + "hr_resize_y": 1024, "alwayson_scripts": {"ADetailer": {"args": [{"ad_model": "face_yolov8n.pt"}]}}, }