Skip to content

Commit

Permalink
small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
genekogan committed Apr 10, 2024
1 parent 0aea6d6 commit b309671
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
30 changes: 25 additions & 5 deletions logos/creation_interfaces/kojii_untitledxyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
24 changes: 21 additions & 3 deletions logos/creation_interfaces/kojii_violetforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand All @@ -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
2 changes: 0 additions & 2 deletions tests/test_creation_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down

0 comments on commit b309671

Please sign in to comment.