Skip to content

Commit

Permalink
Merge pull request #39 from edenartlab/stage
Browse files Browse the repository at this point in the history
bug fixes and seed
  • Loading branch information
genekogan authored Mar 28, 2024
2 parents 3f8ca17 + 9245bf4 commit 899202f
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/animations/little_martians.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def little_martian_poster(request: LittleMartianRequest, callback=None):
lora_scale = random_interval(*data["lora_scale"])
init_image = random.choice(data["init_images"])
init_image_strength = random_interval(*data["init_image_strength"])
seed = request.seed if request.seed else random.randint(0, 1000000)

character = EdenCharacter(character_id)

Expand Down Expand Up @@ -73,6 +74,7 @@ def little_martian_poster(request: LittleMartianRequest, callback=None):
"height": height,
"adopt_aspect_from_init_img": False,
"n_samples": 1,
"seed": seed,
}

image_url, thumbnail_url = replicate.sdxl(config)
Expand Down
7 changes: 6 additions & 1 deletion app/creation_interfaces/kojii_chebel.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ class KojiiChebelRequest(BaseModel):
aspect_ratio: AspectRatio
abstract: float
color: ColorType
seed: Optional[int] = Field(default=None, description="Random seed")


def kojii_chebel(request: KojiiChebelRequest, callback=None):
lora_scale = request.abstract
seed = request.seed if request.seed else random.randint(0, 1000000)

if request.color == ColorType.color:
color_mode = "soft pastel color tones"
Expand Down Expand Up @@ -79,9 +81,12 @@ def kojii_chebel(request: KojiiChebelRequest, callback=None):
"guidance_scale": guidance_scale,
"sampler": "euler",
"steps": 42,
"seed": random.randint(0, 1000000),
"seed": seed,
}

print("THE CONFIG")
print(config)

image_url, thumbnail_url = replicate.sdxl(
config,
model_version="abraham-ai/eden-sd-pipelines-sdxl:a541eb2e611fc66ccd0faac634a7f7c0c7684977b7b54d0eb599ff352f343884",
Expand Down
9 changes: 8 additions & 1 deletion app/creation_interfaces/kojii_huemin.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class KojiiHueminRequest(BaseModel):
# season: Season
# time_of_day: TimeOfDay
# color: Color
seed: Optional[int] = Field(default=None, description="Random seed")


def generate_prompt(selected_climate, selected_landform, selected_body_of_water):
Expand Down Expand Up @@ -195,8 +196,14 @@ def kojii_huemin(request: KojiiHueminRequest, callback=None):
print("HUMIN REQUEST")
print(request)
prompt = generate_prompt(request.climate, request.landform, request.body_of_water)
seed = request.seed if request.seed else random.randint(0, 1000000)
print(prompt)
config = {"mode": "kojii/huemin", "text_input": prompt}

config = {
"mode": "kojii/huemin",
"text_input": prompt,
"seed": seed,
}

image_url, thumbnail_url = replicate.sdxl(config)

Expand Down
4 changes: 3 additions & 1 deletion app/creation_interfaces/kojii_makeitrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class KojiiMakeitradRequest(BaseModel):
clouds: bool
pool: bool
aspect_ratio: AspectRatio
seed: Optional[int] = Field(default=None, description="Random seed")


settings = {"inside": "interior", "outside": "exterior"}
Expand Down Expand Up @@ -95,6 +96,7 @@ def kojii_makeitrad(request: KojiiMakeitradRequest, callback=None):
location = locations[request.location.value]
time = times[request.time.value]
color = colors[request.color.value]
seed = request.seed if request.seed else random.randint(0, 1000000)

clouds = "clouds, " if request.clouds else ""
pool = "(pool:1.5)," if request.pool else ""
Expand All @@ -116,7 +118,7 @@ def kojii_makeitrad(request: KojiiMakeitradRequest, callback=None):
"n_samples": 1,
"negative_prompt": negative_prompt,
"guidance_scale": 7,
"seed": random.randint(0, 1000000),
"seed": seed,
}

output = replicate.run_task(config, model_name="abraham-ai/eden-comfyui")
Expand Down
11 changes: 7 additions & 4 deletions app/creation_interfaces/kojii_untitledxyz.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class KojiiUntitledxyzRequest(BaseModel):
ge=0.0,
le=1.0,
)
seed: Optional[int] = Field(default=None, description="Random seed")


def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
seed = request.seed if request.seed else random.randint(0, 1000000)

print("====== UNTITLED =======")
print(request)
Expand All @@ -38,8 +40,8 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
"close up of a single column fragment, dense wires and thick electrical cables, computer circuits, corrosion, pen and ink, wires drawn with pale yellow, red, blue, green, solid white background, sharpness, noise.",
]
text_inputs_to_interpolate_weights = [
1 - 2 * request.human_machine_nature,
2 * request.human_machine_nature,
2 * (1 - request.human_machine_nature),
]

else:
Expand All @@ -48,8 +50,8 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
"close up of a single column fragment, pen and ink, dense vegetation, wrapped in vines emerging from cracks, large leaves, dense lichen, diverse plants drawn with bright green, red, orange, blue, cyan, magenta, yellow, oversaturated, neons, solid white background, sharpness, noise.",
]
text_inputs_to_interpolate_weights = [
1 - 2 * (request.human_machine_nature - 0.5),
2 * (request.human_machine_nature - 0.5),
2 * (1 - (request.human_machine_nature - 0.5)),
]

elif request.type == Type.context:
Expand All @@ -60,8 +62,8 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
"an isometric architectural drawing, displaying an ultra close up of a modernist building made of computer parts, dodecahedrons, textural details, emphasizing entangled wires with intense precision, the intricate web of wires are seen up close, accentuating the fusion of modern and ancient, the image depicts wires illustrated with vibrant colors, sharpness, noise.",
]
text_inputs_to_interpolate_weights = [
1 - 2 * request.human_machine_nature,
2 * request.human_machine_nature,
2 * (1 - request.human_machine_nature),
]

else:
Expand All @@ -70,8 +72,8 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
"an isometric architectural drawing, displaying an ultra close up of a modern superstructure, geometric stone blocks, emphasis on dense overwhelming vines with intense precision, plants are shot up close, accentuating the fusion of nature and columns, the image depicts giant leaves illustrated with vibrant colors, solid white background, sharpness, noise.",
]
text_inputs_to_interpolate_weights = [
1 - 2 * (request.human_machine_nature - 0.5),
2 * (request.human_machine_nature - 0.5),
2 * (1 - (request.human_machine_nature - 0.5)),
]

config = {
Expand All @@ -83,6 +85,7 @@ def kojii_untitledxyz(request: KojiiUntitledxyzRequest, callback=None):
),
"lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/d2e6d1f8ccfca428ba42fa56a0384a4261d32bf1ee8b0dc952d99da9011daf39.tar",
"lora_scale": 0.8,
"seed": seed,
}

print("CONFIG")
Expand Down
7 changes: 4 additions & 3 deletions app/creation_interfaces/kojii_violetforest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ class KojiiVioletforestRequest(BaseModel):
le=1.0,
)
style: Style = Field(default=Style.Kawaii, description="Style")
seed: Optional[int] = Field(default=None, description="Random seed")


def kojii_violetforest(request: KojiiVioletforestRequest, callback=None):
seed = request.seed if request.seed else random.randint(0, 1000000)

if request.style == Style.Kawaii:
modifiers = "kawaii, kawaii, kawaii, kawaii"
elif request.style == Style.Stars:
Expand Down Expand Up @@ -55,11 +58,9 @@ def kojii_violetforest(request: KojiiVioletforestRequest, callback=None):
),
"lora": "https://edenartlab-prod-data.s3.us-east-1.amazonaws.com/e3b036c0a9949de0a5433cb6c7e54b540c47535ce7ae252948177304542ca4da.tar",
"lora_scale": 0.7,
"seed": seed,
}

print("DO IT!")
print(config)

image_url, thumbnail_url = replicate.sdxl(config)

return image_url, thumbnail_url
1 change: 1 addition & 0 deletions app/models/little_martians.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ class LittleMartianRequest(BaseModel):
aspect_ratio: AspectRatio
model: str = "gpt-4-1106-preview"
params: dict = {}
seed: Optional[int] = Field(default=None, description="Random seed")
2 changes: 2 additions & 0 deletions tests/test_creation_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ 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 899202f

Please sign in to comment.