diff --git a/logos/creation_interfaces/kojii_chebel.py b/logos/creation_interfaces/kojii_chebel.py index 0fec644..0ab96d9 100644 --- a/logos/creation_interfaces/kojii_chebel.py +++ b/logos/creation_interfaces/kojii_chebel.py @@ -34,7 +34,7 @@ class KojiiChebelRequest(BaseModel): def kojii_chebel(request: KojiiChebelRequest, callback=None): - lora_scale = request.abstract + lora_scale = 0.44 + 0.52 * request.abstract seed = request.seed if request.seed else random.randint(0, 1000000) if request.color == ColorType.color: @@ -42,14 +42,12 @@ def kojii_chebel(request: KojiiChebelRequest, callback=None): negative_prompt = "saturated" else: color_mode = "black and white" - negative_prompt = ( - "color, colors, yellow, orange, red, pink, purple, blue, green" - ) + negative_prompt = "yellow, blue" if request.number == Number.one: - prompt = f"in the style of , oil paint, {color_mode}, woman, dance, brush strokes" + prompt = f"oil painting in the style of , oil paint, {color_mode}, woman, dance, expressive brushstrokes" elif request.number == Number.many: - prompt = f"in the style of , oil paint, {color_mode}, women, dance, brush strokes" + prompt = f"oil painting in the style of , oil paint, {color_mode}, many women, dance, expressive brushstrokes" if request.aspect_ratio == AspectRatio.portrait: w, h = 1024, 1536 @@ -62,16 +60,14 @@ def kojii_chebel(request: KojiiChebelRequest, callback=None): control_image_strength = 0.84 guidance_scale = 8 - negative_prompt += ( - ", ugly, watermark, text, tiling, blurred, grainy, signature, cut off, draft" - ) + negative_prompt += ", watermark, text, tiling, out of frame, blurry, blurred, grainy, signature, cut off, draft" config = { "mode": "controlnet", "controlnet_type": "canny-edge", "text_input": prompt, "uc_text": negative_prompt, - "lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/431ff8fb8edf1fcf8d1bc1ddcc2662479ced491c6b98784cdb4b0aa6d70cd09c.tar", + "lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/d93ba7c3b642816c3ab2f5c1755539e222e902d52c6a63064feb57a6cd2c5ba7.tar", "lora_scale": lora_scale, "control_image": f"https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/{control_image}", "control_image_strength": control_image_strength, @@ -80,7 +76,7 @@ def kojii_chebel(request: KojiiChebelRequest, callback=None): "adopt_aspect_from_init_img": True, "guidance_scale": guidance_scale, "sampler": "euler", - "steps": 42, + "steps": 50, "seed": seed, } diff --git a/logos/creation_interfaces/kojii_untitledxyz.py b/logos/creation_interfaces/kojii_untitledxyz.py index ea76a61..da95ecd 100644 --- a/logos/creation_interfaces/kojii_untitledxyz.py +++ b/logos/creation_interfaces/kojii_untitledxyz.py @@ -26,6 +26,24 @@ class KojiiUntitledxyzRequest(BaseModel): seed: Optional[int] = Field(default=None, description="Random seed") +# def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None): +# import requests +# from ..creation_interfaces import KojiiUntitledxyzRequest +# for h in [0.0, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.333333, 0.4, 0.45, 0.5, 0.55, 0.6, 0.666667, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 0.99, 1.0]: +# for s in [Type.column]: #, Type.context]: +# req = KojiiUntitledxyzRequest( +# human_machine_nature=h, +# type=s, +# seed=5 +# ) +# image_url, thumbnail_url, config = kojii_untitledxyz1(req) +# print("\n\n\n\n\n\n\n\n\n================") +# print("DO ", s, h) +# print(f'images/bbb_{s.value}_{h}.jpg') +# with open(f'images/bbb_{s.value}_{h}.jpg', 'wb') as f: +# f.write(requests.get(image_url).content) + + def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None): seed = request.seed if request.seed else random.randint(0, 1000000) @@ -60,8 +78,8 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None): "close up of a single column, highly detailed, pen and ink, stone drawn with light yellow, orange, light brown, solid white background, sharpness, noise.", ] text_inputs_to_interpolate_weights = [ - 1 - 2 * (request.human_machine_nature - 2 / 3), - 2 * (request.human_machine_nature - 2 / 3), + 1 - 3 * (request.human_machine_nature - 2 / 3), + 3 * (request.human_machine_nature - 2 / 3), ] elif request.type == Type.context: @@ -110,9 +128,11 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None): } print("CONFIG") - print(config) - print("=======") + print(request.human_machine_nature) + print(config["text_inputs_to_interpolate"]) + print(config["text_inputs_to_interpolate_weights"]) + print("=======\n\n\n") image_url, thumbnail_url = replicate.sdxl(config) - return image_url, thumbnail_url + return image_url, thumbnail_url, config diff --git a/logos/creation_interfaces/kojii_violetforest.py b/logos/creation_interfaces/kojii_violetforest.py index aa8cc4a..e8a8988 100644 --- a/logos/creation_interfaces/kojii_violetforest.py +++ b/logos/creation_interfaces/kojii_violetforest.py @@ -29,6 +29,22 @@ class KojiiVioletforestRequest(BaseModel): def kojii_violetforest(request: KojiiVioletforestRequest, callback=None): + import requests + from ..creation_interfaces import KojiiVioletforestRequest + + for c in [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]: + for s in [Style.Kawaii, Style.Stars, Style.Lace, Style.Flowers]: + req = KojiiVioletforestRequest( + cybertwee_cyberpunk=float(c), + style=s, + seed=5, + ) + image_url, thumbnail_url = kojii_violetforest1(req) + with open(f"images/{s.value}_{c}.jpg", "wb") as f: + f.write(requests.get(image_url).content) + + +def kojii_violetforest1(request: KojiiVioletforestRequest, callback=None): seed = request.seed if request.seed else random.randint(0, 1000000) if request.style == Style.Kawaii: @@ -44,6 +60,7 @@ def kojii_violetforest(request: KojiiVioletforestRequest, callback=None): f"a stunning image of a cute cybertwee girl, {modifiers}", f"a stunning image of an Aston Martin sportscar, {modifiers}", ] + print(request) text_inputs_to_interpolate_weights = [ request.cybertwee_cyberpunk, 1 - request.cybertwee_cyberpunk, @@ -56,11 +73,12 @@ def kojii_violetforest(request: KojiiVioletforestRequest, callback=None): "text_inputs_to_interpolate_weights": " | ".join( [str(t) for t in text_inputs_to_interpolate_weights], ), - "lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/e3b036c0a9949de0a5433cb6c7e54b540c47535ce7ae252948177304542ca4da.tar", - "lora_scale": 0.7, + # "lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/e3b036c0a9949de0a5433cb6c7e54b540c47535ce7ae252948177304542ca4da.tar", + # "lora_scale": 0.7, "seed": seed, } - + print("CONFIG") + print(config) image_url, thumbnail_url = replicate.sdxl(config) return image_url, thumbnail_url diff --git a/tests/test_creation_interfaces.py b/tests/test_creation_interfaces.py index e0db52c..00284e6 100644 --- a/tests/test_creation_interfaces.py +++ b/tests/test_creation_interfaces.py @@ -64,8 +64,6 @@ def test_kojii_untitledxyz(): "human_machine_nature": random.uniform(0, 1), } - request = {"type": "column", "human_machine_nature": 0.5} - response = client.post("/kojii/untitledxyz", json=request) print(response.json())