Skip to content

Commit

Permalink
Merge pull request #43 from edenartlab/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
genekogan authored Apr 4, 2024
2 parents 37beb16 + 3971953 commit 2250c8a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 47 deletions.
92 changes: 57 additions & 35 deletions app/creation_interfaces/kojii_huemin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Landform(Enum):
volcanoes = "volcanoes"
rivers = "rivers"
lakes = "lakes"
glaciers = "glaciers"
glaciers = "icebergs"
fjords = "fjords"
deltas = "deltas"
estuaries = "estuaries"
Expand All @@ -50,11 +50,12 @@ class Landform(Enum):
craters = "craters"
atolls = "atolls"
peninsula = "peninsula"
islands = "islands"
islands = "island surrounder by water"
basins = "basins"
gorges = "gorges"
waterfalls = "waterfalls"
rift_valleys = "rift valleys"
lava_flows = "obsidian lava flows steam"


class BodyOfWater(Enum):
Expand All @@ -66,7 +67,6 @@ class BodyOfWater(Enum):
streams = "streams"
creeks = "creeks"
estuaries = "estuaries"
fjords = "fjords"
bays = "bays"
gulfs = "gulfs"
lagoons = "lagoons"
Expand All @@ -81,22 +81,22 @@ class BodyOfWater(Enum):


class Structure(Enum):
bridges = "bridges"
tunnels = "tunnels"
dams = "dams"
skyscrapers = "skyscrapers"
castles = "castles"
temples = "temples"
churches = "churches"
mosques = "mosques"
fortresses = "fortresses"
monuments = "monuments"
statues = "statues"
towers = "towers"
silos = "silos"
industrial_factories = "industrial factories"
piers = "piers"
harbors = "harbors"
bridges = "small bridges"
tunnels = "small tunnels"
dams = "small dams"
skyscrapers = "small skyscrapers"
castles = "small castles"
temples = "small temples"
churches = "small churches"
mosques = "small mosques"
fortresses = "small fortresses"
monuments = "small monuments"
statues = "small statues"
towers = "small towers"
silos = "small silos"
industrial_factories = "small industrial factories"
piers = "small piers"
harbors = "small harbors"


class Season(Enum):
Expand All @@ -106,8 +106,8 @@ class Season(Enum):
winter = "winter"
rainy = "rainy"
sunny = "sunny"
cloudy = "cloudy"
stormy_clouds = "stormy clouds"
clouds_from_above = "clouds from above"
stormy_clouds_from_above = "stormy clouds from above"
foggy_mist = "foggy mist"
snowy = "snowy"
windy = "windy"
Expand All @@ -117,22 +117,21 @@ class Season(Enum):
cold = "cold"
mild = "mild"
freezing = "freezing"
thunderstorms = "thunderstorms"
hail = "hail"
sleet = "sleet"
blizzard = "blizzard"
heatwave = "heatwave"
drought = "drought"


class TimeOfDay(Enum):
dawn = "dawn"
morning = "morning"
noon = "noon"
afternoon = "afternoon"
dusk = "dusk"
evening = "evening"
sunset = "sunset"
# class TimeOfDay(Enum):
# dawn = "dawn"
# morning = "morning"
# noon = "noon"
# afternoon = "afternoon"
# dusk = "dusk"
# evening = "evening"
# sunset = "sunset"


class Color(Enum):
Expand Down Expand Up @@ -172,18 +171,20 @@ class KojiiHueminRequest(BaseModel):
def generate_prompt(selected_climate, selected_landform, selected_body_of_water):
base_prompt = "isometric generative landscape orthographic abstract aj casson perlin noise 3d shaders areal embroidery minimalism claude monet oil painting pastel"

selected_structure = random.choice(list(Structure)).value
selected_season = random.choice(list(Season)).value
selected_time_of_day = random.choice(list(TimeOfDay)).value
selected_colors = random.choice(list(Color)).value
selected_structure = (
random.choice(list(Structure)).value if random.random() < 0.20 else ""
)
selected_season = random.choice(list(Season)).value if random() < 0.95 else ""
# selected_time_of_day = random.choice(list(TimeOfDay)).value
selected_colors = random.choice(list(Color)).value if random() < 0.95 else ""

selected_keywords = [
selected_climate.value,
selected_landform.value,
selected_body_of_water.value,
selected_structure,
selected_season,
selected_time_of_day,
# selected_time_of_day,
selected_colors,
]
landscape_keywords = " ".join(selected_keywords)
Expand All @@ -192,6 +193,27 @@ def generate_prompt(selected_climate, selected_landform, selected_body_of_water)
return prompt


def kojii_huemin(request: KojiiHueminRequest, callback=None):
prompt = generate_prompt(request.climate, request.landform, request.body_of_water)
seed = request.seed if request.seed else random.randint(0, 1000000)
uc_text = ["blurry bad dull green", "blurry bad dull"][random.randint(0, 1)]

print("HUEMIN REQUEST")
print(request)
print(prompt)

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

image_url, thumbnail_url = replicate.sdxl(config)

return image_url, thumbnail_url


def kojii_huemin(request: KojiiHueminRequest, callback=None):
print("HUMIN REQUEST")
print(request)
Expand Down
6 changes: 0 additions & 6 deletions app/plugins/eden.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
# config = {
# "text_input": "someone here",
# }
# print("GO", config)
# print("ok 2")
# urls = eden.create(generator_name='create', config=config)
# print("ok 3")

# print(urls[0])
# print("ok 4")

# return urls[0]
6 changes: 3 additions & 3 deletions app/plugins/replicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def run_task(
if not model_version:
version = get_version(r, model_name)
model_version = f"{model_name}:{version}"
output = r.run(ref=deployment, input=config)
output = r.run(ref=model_version, input=config)

return output

Expand Down Expand Up @@ -102,8 +102,8 @@ def sdxl(

output = run_task(
config,
model_name="abraham-ai/eden-sd-pipelines-sdxl",
model_version=model_version,
# model_name="abraham-ai/eden-sd-pipelines-sdxl",
# model_version=model_version,
model_deployment=model_deployment,
)
output = list(output)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_creation_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def test_kojii_huemin():
"volcanoes",
"rivers",
"lakes",
"glaciers",
"icebergs",
"fjords",
"deltas",
"estuaries",
Expand All @@ -140,11 +140,12 @@ def test_kojii_huemin():
"craters",
"atolls",
"peninsula",
"islands",
"island surrounder by water",
"basins",
"gorges",
"waterfalls",
"rift valleys",
"obsidian lava flows steam",
],
),
"body_of_water": random.choice(
Expand All @@ -157,7 +158,6 @@ def test_kojii_huemin():
"streams",
"creeks",
"estuaries",
"fjords",
"bays",
"gulfs",
"lagoons",
Expand Down

0 comments on commit 2250c8a

Please sign in to comment.