adding upscaling

This commit is contained in:
Luke Robles 2023-09-14 09:37:15 -07:00
parent 8d26ea6ccd
commit e0243c2255
2 changed files with 11 additions and 3 deletions

View File

@ -38,14 +38,16 @@ class StableDiffusion(commands.Cog):
# Everyone can use my gaming computer temporarily # Everyone can use my gaming computer temporarily
ip = "192.168.1.19" ip = "192.168.1.19"
steps = 50 steps = 50
enable_upscale = "false"
# Send my requests to my gaming computer with the 3080 (if its up) # Send my requests to my gaming computer with the 3080 (if its up)
if ctx.author.id == core_utils.my_id: if ctx.author.id == core_utils.my_id:
ip = "192.168.1.19" ip = "192.168.1.19"
positive_prompt = ( positive_prompt = (
positive_prompt positive_prompt
+ " <lora:add_detail:0.3> <lora:bimbostyleThreeU:0.3> <lora:gigatitums:0.3> <lora:more_details:0.3>" + " <lora:add_detail:0.3> <lora:bimbostyleThreeU:0.4> <lora:gigatitums:0.3> <lora:more_details:0.3>"
) )
enable_upscale = "true"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(1) s.settimeout(1)
try: try:
@ -64,6 +66,7 @@ class StableDiffusion(commands.Cog):
negatives=negative_prompt 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", 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, steps=steps,
enable_upscale=enable_upscale,
) )
await original_message.edit( await original_message.edit(
file=discord.File( file=discord.File(

View File

@ -4,14 +4,19 @@ import httpx
import tempfile 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" url = "http://" + ip + ":" + port + "/sdapi/v1/txt2img"
json_data = { json_data = {
"prompt": positives, "prompt": positives,
"negative_prompt": negatives, "negative_prompt": negatives,
"steps": steps, "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"}]}}, "alwayson_scripts": {"ADetailer": {"args": [{"ad_model": "face_yolov8n.pt"}]}},
} }