Spaces:
Running
on
Zero
Running
on
Zero
File size: 45,457 Bytes
527fcc4 7a9500a 527fcc4 061d802 ced6a2a 527fcc4 ced6a2a 527fcc4 ab4cf94 ced6a2a 527fcc4 6ef117e 061d802 527fcc4 ced6a2a 061d802 da0a17c 061d802 eb4b77d 061d802 527fcc4 061d802 7a9500a 6dd859c 3090477 faf797f ced6a2a 061d802 8001a73 061d802 8001a73 061d802 0808774 061d802 ced6a2a da0a17c 061d802 ced6a2a 061d802 ced6a2a da0a17c 0808774 ced6a2a da0a17c ced6a2a da0a17c ced6a2a 7addd34 ced6a2a 061d802 7addd34 061d802 7addd34 061d802 7addd34 061d802 ab4cf94 7addd34 69421e3 061d802 7addd34 061d802 ab4cf94 7addd34 69421e3 061d802 35bcea0 7addd34 061d802 7addd34 061d802 7addd34 061d802 16e4012 7addd34 061d802 7addd34 061d802 da0a17c 061d802 16e4012 7addd34 061d802 7addd34 061d802 da0a17c 061d802 16e4012 7addd34 061d802 7addd34 061d802 da0a17c 061d802 16e4012 7addd34 061d802 ab4cf94 da0a17c ab4cf94 7addd34 ab4cf94 16e4012 7addd34 ab4cf94 69421e3 061d802 7addd34 061d802 da0a17c 061d802 16e4012 7addd34 061d802 7addd34 061d802 16e4012 7addd34 061d802 da0a17c 061d802 7addd34 061d802 16e4012 7addd34 061d802 da0a17c 061d802 7addd34 061d802 16e4012 7addd34 061d802 69421e3 061d802 7addd34 69421e3 7addd34 492a331 061d802 6ef117e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
# utils/constants.py
# constants.py contains all the constants used in the project such as the default LUT example image, prompts, negative prompts, pre-rendered maps, models, LoRA weights, and more.
# execptions made for some environmental variables
import os
from pathlib import Path
from dotenv import load_dotenv
import numpy as np
#Set the environment variables
#os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:256,expandable_segments:True"
#os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
#os.environ["TF_CPP_MIN_LOG_LEVEL"] = '2'
#os.environ['CUDA_MODULE_LOADING']='LAZY'
#os.environ['USE_FLASH_ATTENTION'] = '1'
#os.environ['XFORMERS_FORCE_DISABLE_TRITON']= '1'
#os.environ['XFORMERS_FORCE_DISABLE_TORCHSCRIPT']= '1'
#os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
#os.environ["PYTORCH_NVML_BASED_CUDA_CHECK"] = "1"
#os.environ["CUDA_VISIBLE_DEVICES"] = "0"
#os.environ["NVIDIA_VISIBLE_DEVICES"] = "0"
#os.environ["ZEROGPU_VERSION"] = "2"
#os.environ["ZEROGPU_V2"] = "true"
#os.environ["ZERO_GPU_V2"] = "true"
#os.environ["ZERO_GPU_PATCH_TORCH_DEVICE"]='1'
IS_SHARED_SPACE = "Surn/HexaGrid" in os.environ.get('SPACE_ID', '')
# Load environment variables from .env file
dotenv_path = Path(__file__).parent.parent / '.env'
load_dotenv(dotenv_path)
# Function to load env vars from .env and create Python variables
def load_env_vars(env_path):
try:
with open(env_path, 'r') as file:
for line in file:
# Skip empty lines or comments
line = line.strip()
if line and not line.startswith('#'):
# Split on the first '=' only
if '=' in line:
key, value = line.split('=', 1)
key = key.strip()
value = value.strip()
# Dynamically create a Python variable with the key name
globals()[key] = value
# Also update os.environ (optional, for consistency)
os.environ[key] = value
except FileNotFoundError:
print(f"Warning: .env file not found at {env_path}")
# Set the temporary folder location
# os.environ['TEMP'] = r'e:\\TMP'
# os.environ['TMPDIR'] = r'e:\\TMP'
# os.environ['XDG_CACHE_HOME'] = r'E:\\cache'
USE_FLASH_ATTENTION = os.getenv("USE_FLASH_ATTENTION", "0") == "1"
HF_API_TOKEN = os.getenv("HF_TOKEN")
if not HF_API_TOKEN:
raise ValueError("HF_TOKEN is not set. Please check your .env file.")
default_lut_example_img = "./LUT/daisy.jpg"
MAX_SEED = np.iinfo(np.int32).max
TARGET_SIZE = (2688,1536)
BASE_HEIGHT = 640
SCALE_FACTOR = (12/5)
TMPDIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'tmp')
os.makedirs(TMPDIR, exist_ok=True)
PROMPTS = {
"Mecha Wasteland Arena": "Regional overhead view, directly from above, centered on the map, orthographic Mecha battlefield map. post-industrial wasteland with crumbling structures, volcanic ridges, scrapyards, and ash plains. Features elevated overwatch positions for long-range combat and tight brawling areas for close-quarters engagements. Partial edge hexes are black. Colors: red, gray, muted orange, ash white, dark brown.",
"BorderBlack": "Planetary overhead view, directly from above, centered on the planet’s surface, orthographic hexagon-based alien world map with black borders. Features rivers, mountains, volcanoes, and polar snow regions. Colors: light blue, green, tan, brown. No reflections or shadows. Partial edge hexes are black.",
"Earth": "Planetary overhead view, directly from above, centered on the planet’s surface, orthographic Earth-like world map with rivers, mountains, volcanoes, and polar snow regions. Colors: light blue, green, tan, brown. No reflections or shadows. Partial edge hexes are black.",
"Beeuty": "Regional overhead view, directly from above, centered on the map, orthographic tabletop gaming map with honeycomb-shaped terrain, lakes, dense forests, magical flora, and hex grids. Designed for clarity and strategic gameplay. Colors: yellow, green, purple, brown. Partial edge hexes are black.",
"Scifi City": "Regional overhead view, directly from above, centered on the map, orthographic futuristic urban battlefield map with lakes, forests, ruined buildings, and city streets. Designed for clarity and strategic gameplay in tabletop games. Colors: teal, dark green, violet, brown. Partial edge hexes are black.",
"Alien Landscape": "Planetary overhead view, directly from above, centered on the planet’s surface, orthographic barren alien world map composed of hexagon tiles. Features light blue rivers, brown mountains, red volcanoes, and white polar snow. Colors: light blue, green, tan, brown. Partial edge hexes are black.",
"Alien World": "Planetary overhead view, directly from above, centered on the planet’s surface, orthographic alien world map built from hexagon tiles. Includes rivers, mountains, volcanoes, and snowy regions. Colors: light blue, green, tan, brown. Partial edge hexes are black.",
"Mystic Forest": "Regional overhead view, directly from above, centered on the map, orthographic mystic forest map with lakes, dense forests, magical flora, and hex grids. Designed for clarity and strategic gameplay in tabletop gaming. Colors: light blue, green, purple, brown. Partial edge hexes are black.",
"Medieval Battlefield": "Regional overhead view, directly from above, centered on the map, orthographic medieval battlefield map with lakes, forests, and magical fauna. Designed for clarity and strategic gameplay in tabletop games. Colors: teal, dark green, violet, brown. Partial edge hexes are black.",
"Dungeon Interior": "Regional overhead view, directly from above, centered on the map, orthographic dungeon interior map for tabletop gaming. Features stone walls, corridors, rooms with doors, traps, and treasure chests. Designed for clarity and strategic gameplay. Colors: gray, brown, dark blue. Partial edge hexes are black.",
"Desert Wasteland": "Regional overhead view, directly from above, centered on the map, orthographic desert wasteland map for tabletop gaming. Features sand dunes, rocky canyons, oases, and ancient ruins. Colors: yellow, tan, brown, blue, green. Partial edge hexes are black.",
"Prompt": None # Indicates that the prompt should be taken from prompt_textbox
}
NEGATIVE_PROMPTS = {
"Mecha Wasteland Arena": "humans, old_buildings, water, bright colors, text, logos, shadows, Earth geography, isometric, camera_angle",
"BorderBlack": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric, camera_angle",
"Earth": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, missing map of the Earth, isometric, camera_angle",
"Beeuty": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, map of the Earth, isometric, camera_angle",
"Scifi City": "humans, missing_buildings, vehicles, text, logos, reflections, shadows, Earth, isometric, camera_angle",
"Alien Landscape": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric, camera_angle",
"Alien World": "Earth, humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric, camera_angle",
"Mystic Forest": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric, camera_angle",
"Medieval Battlefield": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric, camera_angle",
"Dungeon Interior":"humans, modern_buildings, vehicles, text, logos, reflections, shadows, outdoor elements, realistic map of the Earth, isometric, camera_angle",
"Desert Wasteland":"humans, modern_buildings, vehicles, text, logos, reflections, shadows, lush forests, large bodies of water, snow, realistic map of the Earth, isometric, camera_angle",
"Prompt": None # Indicates that the negative prompt should be taken from negative_prompt_textbox
}
# Directory containing the pre-rendered hexagon maps
PRERENDER_DIR = "images/prerendered"
# # List of pre-rendered hexagon map files
# PRE_RENDERED_MAPS = ['alien_orb_land_1.png', 'alien_prarie_1.png', 'alien_world_1.png', 'alien_world_2.png', 'alien_world_3.png', 'alien_world_4.png', 'alien_world_5.png', 'BurntCity.png', 'canyon_water_1.png', 'CONQ_Caustic_Valley.png', 'CONQ_Frozen_City.png', 'CONQ_Hellebore_Springs.png', 'CONQ_Terra_Therma.png', 'CONQ_Viridian_Bog.png', 'cute3dkawaii.PNG', 'dark_dirt_elevations_1.png', 'donald_park.png', 'elevated_peninsula_1.png', 'Firefly_alien_canyons_1.png', 'Firefly_alien_canyons_2.png', 'Firefly_alien_dry_canyons_1.png', 'Firefly_alien_dry_canyons_2.png', 'Firefly_alien_map_1.png', 'Firefly_hpg_terrain_1.png', 'Firefly_hpg_terrain_2.png', 'Firefly_river_dry_1.png', 'Firefly_river_running_1.png', 'Firefly_topographical_alien_desert_1.png', 'Firefly_topographical_canyon_1.png', 'Firefly_topographical_height_map_1.png', 'Firefly_topographical_height_map_2.png', 'Firefly_topographical_height_map_3.png', 'Firefly_topographical_height_map_5.png', 'Firefly_topographical_height_map_6.png', 'Firefly_topographical_marble_1.png', 'Firefly_topographical_moon_1.png', 'fractal_islands.png', 'Genison.png', 'green_farming_alien_world_1.png', 'green_farming_alien_world_2.png', 'grey_barren_alien_world_1.png', 'grey_barren_alien_world_2.png', 'grey_barren_alien_world_3.png', 'grey_barren_alien_world_4.png', 'grey_barren_alien_world_5.png', 'grey_barren_alien_world_6.png', 'grey_barren_alien_world_7.png', 'grey_waterless_alien_world_map.png', 'grid_1.png', 'Hex_gen_map.png', 'hex_grass_dirty.png', 'hex_military_industrial_alien_world_map.png', 'hex_mixed_elevations_battlefield_1.png', 'hex_mixed_elevations_battlefield_2.png', 'hex_tree_territory.png', 'lake_city.png', 'mickey_lagoon.png', 'mixed_elevations_battlefield_3.png', 'n6W9Hc.png', 'oasis_mixed_elevations_1.png', 'pic526383.png', 'pinecone_islands.png', 'purple_pines.png', 'red_volcanic_alien_1.png', 'red_volcanic_alien_2.png', 'red_volcanic_alien_3.png', 'red_volcanic_alien_4.png', 'roadway_1.png', 'snowy_lake.png', 'snowy_rolling_hills_1.png', 'volcanic_alien_world_map.png', 'war_torn_post_apocalyptic_alien_world_map.png']
# # Create full paths for pre-rendered maps
# pre_rendered_maps_paths = [os.path.join(PRERENDER_DIR, map_file).replace("\\", "/") for map_file in PRE_RENDERED_MAPS]
# pre_rendered_maps_paths_api_file = [f"./gradio_api/file={map_path}" for map_path in pre_rendered_maps_paths]
# Generate a dictionary with cleaned-up names as keys and file paths as values
#PRE_RENDERED_MAPS_JSON = {
# os.path.splitext(file.replace("_", " ").replace("-", " ").replace(" ", " ").strip())[0]: os.path.join(PRERENDER_DIR, file)
# for file in PRE_RENDERED_MAPS
#}
#PRE_RENDERED_MAPS_JSON
#{'alien orb land 1': 'images/prerendered/alien_orb_land_1.png', 'alien prarie 1': 'images/prerendered/alien_prarie_1.png', 'alien world 1': 'images/prerendered/alien_world_1.png', 'alien world 2': 'images/prerendered/alien_world_2.png', 'alien world 3': 'images/prerendered/alien_world_3.png', 'alien world 4': 'images/prerendered/alien_world_4.png', 'alien world 5': 'images/prerendered/alien_world_5.png', 'BurntCity': 'images/prerendered/BurntCity.png', 'canyon water 1': 'images/prerendered/canyon_water_1.png', 'CONQ Caustic Valley': 'images/prerendered/CONQ_Caustic_Valley.png', 'CONQ Frozen City': 'images/prerendered/CONQ_Frozen_City.png', 'CONQ Hellebore Springs': 'images/prerendered/CONQ_Hellebore_Springs.png', 'CONQ Terra Therma': 'images/prerendered/CONQ_Terra_Therma.png', 'CONQ Viridian Bog': 'images/prerendered/CONQ_Viridian_Bog.png', 'cute3dkawaii': 'images/prerendered/cute3dkawaii.png', 'dark dirt elevations 1': 'images/prerendered/dark_dirt_elevations_1.png', 'donald park': 'images/prerendered/donald_park.png', 'elevated peninsula 1': 'images/prerendered/elevated_peninsula_1.png', 'Firefly alien canyons 1': 'images/prerendered/Firefly_alien_canyons_1.png', 'Firefly alien canyons 2': 'images/prerendered/Firefly_alien_canyons_2.png', 'Firefly alien dry canyons 1': 'images/prerendered/Firefly_alien_dry_canyons_1.png', 'Firefly alien dry canyons 2': 'images/prerendered/Firefly_alien_dry_canyons_2.png', 'Firefly alien map 1': 'images/prerendered/Firefly_alien_map_1.png', 'Firefly hpg terrain 1': 'images/prerendered/Firefly_hpg_terrain_1.png', 'Firefly hpg terrain 2': 'images/prerendered/Firefly_hpg_terrain_2.png', 'Firefly river dry 1': 'images/prerendered/Firefly_river_dry_1.png', 'Firefly river running 1': 'images/prerendered/Firefly_river_running_1.png', 'Firefly topographical alien desert 1': 'images/prerendered/Firefly_topographical_alien_desert_1.png', 'Firefly topographical canyon 1': 'images/prerendered/Firefly_topographical_canyon_1.png', 'Firefly topographical height map 1': 'images/prerendered/Firefly_topographical_height_map_1.png', 'Firefly topographical height map 2': 'images/prerendered/Firefly_topographical_height_map_2.png', 'Firefly topographical height map 3': 'images/prerendered/Firefly_topographical_height_map_3.png', 'Firefly topographical height map 5': 'images/prerendered/Firefly_topographical_height_map_5.png', 'Firefly topographical height map 6': 'images/prerendered/Firefly_topographical_height_map_6.png', 'Firefly topographical marble 1': 'images/prerendered/Firefly_topographical_marble_1.png', 'Firefly topographical moon 1': 'images/prerendered/Firefly_topographical_moon_1.png', 'fractal islands': 'images/prerendered/fractal_islands.png', 'Genison': 'images/prerendered/Genison.png', 'green farming alien world 1': 'images/prerendered/green_farming_alien_world_1.png', 'green farming alien world 2': 'images/prerendered/green_farming_alien_world_2.png', 'grey barren alien world 1': 'images/prerendered/grey_barren_alien_world_1.png', 'grey barren alien world 2': 'images/prerendered/grey_barren_alien_world_2.png', 'grey barren alien world 3': 'images/prerendered/grey_barren_alien_world_3.png', 'grey barren alien world 4': 'images/prerendered/grey_barren_alien_world_4.png', 'grey barren alien world 5': 'images/prerendered/grey_barren_alien_world_5.png', 'grey barren alien world 6': 'images/prerendered/grey_barren_alien_world_6.png', 'grey barren alien world 7': 'images/prerendered/grey_barren_alien_world_7.png', 'grey waterless alien world map': 'images/prerendered/grey_waterless_alien_world_map.png', 'grid 1': 'images/prerendered/grid_1.png', 'Hex gen map': 'images/prerendered/Hex_gen_map.png', 'hex grass dirty': 'images/prerendered/hex_grass_dirty.png', 'hex military industrial alien world map': 'images/prerendered/hex_military_industrial_alien_world_map.png', 'hex mixed elevations battlefield 1': 'images/prerendered/hex_mixed_elevations_battlefield_1.png', 'hex mixed elevations battlefield 2': 'images/prerendered/hex_mixed_elevations_battlefield_2.png', 'hex tree territory': 'images/prerendered/hex_tree_territory.png', 'lake city': 'images/prerendered/lake_city.png', 'mickey lagoon': 'images/prerendered/mickey_lagoon.png', 'mixed elevations battlefield 3': 'images/prerendered/mixed_elevations_battlefield_3.png', 'n6W9Hc': 'images/prerendered/n6W9Hc.png', 'oasis mixed elevations 1': 'images/prerendered/oasis_mixed_elevations_1.png', 'pic526383': 'images/prerendered/pic526383.png', 'pinecone islands': 'images/prerendered/pinecone_islands.png', 'purple pines': 'images/prerendered/purple_pines.png', 'red volcanic alien 1': 'images/prerendered/red_volcanic_alien_1.png', 'red volcanic alien 2': 'images/prerendered/red_volcanic_alien_2.png', 'red volcanic alien 3': 'images/prerendered/red_volcanic_alien_3.png', 'red volcanic alien 4': 'images/prerendered/red_volcanic_alien_4.png', 'roadway 1': 'images/prerendered/roadway_1.png', 'snowy lake': 'images/prerendered/snowy_lake.png', 'snowy rolling hills 1': 'images/prerendered/snowy_rolling_hills_1.png', 'volcanic alien world map': 'images/prerendered/volcanic_alien_world_map.png', 'war torn post apocalyptic alien world map': 'images/prerendered/war_torn_post_apocalyptic_alien_world_map.png'}
##PRE_RENDERED_MAPS_JSON = { key: { 'file': value, 'quality': 0 } for key, value in PRE_RENDERED_MAPS_JSON.items()}
PRE_RENDERED_MAPS_JSON_LEVELS = {
'alien orb land 1': {'file': 'images/prerendered/alien_orb_land_1.png', 'thumbnail': 'images/prerendered/th/alien_orb_land_1.png', 'quality': 0},
'alien prarie 1': {'file': 'images/prerendered/alien_prarie_1.png', 'thumbnail': 'images/prerendered/th/alien_prarie_1.png', 'quality': 0},
'alien world 1': {'file': 'images/prerendered/alien_world_1.png', 'thumbnail': 'images/prerendered/th/alien_world_1.png', 'quality': 3},
'alien world 2': {'file': 'images/prerendered/alien_world_2.png', 'thumbnail': 'images/prerendered/th/alien_world_2.png', 'quality': 3},
'alien world 3': {'file': 'images/prerendered/alien_world_3.png', 'thumbnail': 'images/prerendered/th/alien_world_3.png', 'quality': 3},
'alien world 4': {'file': 'images/prerendered/alien_world_4.png', 'thumbnail': 'images/prerendered/th/alien_world_4.png', 'quality': 3},
'alien world 5': {'file': 'images/prerendered/alien_world_5.png', 'thumbnail': 'images/prerendered/th/alien_world_5.png', 'quality': 3},
'BurntCity': {'file': 'images/prerendered/BurntCity.png', 'thumbnail': 'images/prerendered/th/BurntCity.png', 'quality': 2},
'canyon water 1': {'file': 'images/prerendered/canyon_water_1.png', 'thumbnail': 'images/prerendered/th/canyon_water_1.png', 'quality': 0},
'CONQ Caustic Valley': {'file': 'images/prerendered/CONQ_Caustic_Valley.png', 'thumbnail': 'images/prerendered/th/CONQ_Caustic_Valley.png', 'quality': 2},
'CONQ Frozen City': {'file': 'images/prerendered/CONQ_Frozen_City.png', 'thumbnail': 'images/prerendered/th/CONQ_Frozen_City.png', 'quality': 1},
'CONQ Hellebore Springs': {'file': 'images/prerendered/CONQ_Hellebore_Springs.png', 'thumbnail': 'images/prerendered/th/CONQ_Hellebore_Springs.png', 'quality': 2},
'CONQ Terra Therma': {'file': 'images/prerendered/CONQ_Terra_Therma.png', 'thumbnail': 'images/prerendered/th/CONQ_Terra_Therma.png', 'quality': 1},
'CONQ Viridian Bog': {'file': 'images/prerendered/CONQ_Viridian_Bog.png', 'thumbnail': 'images/prerendered/th/CONQ_Viridian_Bog.png', 'quality': 1},
'cute3dkawaii': {'file': 'images/prerendered/cute3dkawaii.png', 'thumbnail': 'images/prerendered/th/cute3dkawaii.png', 'quality': 0},
'dark dirt elevations 1': {'file': 'images/prerendered/dark_dirt_elevations_1.png', 'thumbnail': 'images/prerendered/th/dark_dirt_elevations_1.png', 'quality': 0},
'donald park': {'file': 'images/prerendered/donald_park.png', 'thumbnail': 'images/prerendered/th/donald_park.png', 'quality': 0},
'elevated peninsula 1': {'file': 'images/prerendered/elevated_peninsula_1.png', 'thumbnail': 'images/prerendered/th/elevated_peninsula_1.png', 'quality': 0},
'Firefly alien canyons 1': {'file': 'images/prerendered/Firefly_alien_canyons_1.png', 'thumbnail': 'images/prerendered/th/Firefly_alien_canyons_1.png', 'quality': 2},
'Firefly alien canyons 2': {'file': 'images/prerendered/Firefly_alien_canyons_2.png', 'thumbnail': 'images/prerendered/th/Firefly_alien_canyons_2.png', 'quality': 3},
'Firefly alien dry canyons 1': {'file': 'images/prerendered/Firefly_alien_dry_canyons_1.png', 'thumbnail': 'images/prerendered/th/Firefly_alien_dry_canyons_1.png', 'quality': 3},
'Firefly alien dry canyons 2': {'file': 'images/prerendered/Firefly_alien_dry_canyons_2.png', 'thumbnail': 'images/prerendered/th/Firefly_alien_dry_canyons_2.png', 'quality': 3},
'Firefly alien map 1': {'file': 'images/prerendered/Firefly_alien_map_1.png', 'thumbnail': 'images/prerendered/th/Firefly_alien_map_1.png', 'quality': 3},
'Firefly hpg terrain 1': {'file': 'images/prerendered/Firefly_hpg_terrain_1.png', 'thumbnail': 'images/prerendered/th/Firefly_hpg_terrain_1.png', 'quality': 1},
'Firefly hpg terrain 2': {'file': 'images/prerendered/Firefly_hpg_terrain_2.png', 'thumbnail': 'images/prerendered/th/Firefly_hpg_terrain_2.png', 'quality': 0},
'Firefly river dry 1': {'file': 'images/prerendered/Firefly_river_dry_1.png', 'thumbnail': 'images/prerendered/th/Firefly_river_dry_1.png', 'quality': 3},
'Firefly river running 1': {'file': 'images/prerendered/Firefly_river_running_1.png', 'thumbnail': 'images/prerendered/th/Firefly_river_running_1.png', 'quality': 3},
'Firefly topographical alien desert 1': {'file': 'images/prerendered/Firefly_topographical_alien_desert_1.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_alien_desert_1.png', 'quality': 3},
'Firefly topographical canyon 1': {'file': 'images/prerendered/Firefly_topographical_canyon_1.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_canyon_1.png', 'quality': 3},
'Firefly topographical height map 1': {'file': 'images/prerendered/Firefly_topographical_height_map_1.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_height_map_1.png', 'quality': 3},
'Firefly topographical height map 2': {'file': 'images/prerendered/Firefly_topographical_height_map_2.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_height_map_2.png', 'quality': 3},
'Firefly topographical height map 3': {'file': 'images/prerendered/Firefly_topographical_height_map_3.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_height_map_3.png', 'quality': 3},
'Firefly topographical height map 5': {'file': 'images/prerendered/Firefly_topographical_height_map_5.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_height_map_5.png', 'quality': 3},
'Firefly topographical height map 6': {'file': 'images/prerendered/Firefly_topographical_height_map_6.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_height_map_6.png', 'quality': 3},
'Firefly topographical marble 1': {'file': 'images/prerendered/Firefly_topographical_marble_1.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_marble_1.png', 'quality': 3},
'Firefly topographical moon 1': {'file': 'images/prerendered/Firefly_topographical_moon_1.png', 'thumbnail': 'images/prerendered/th/Firefly_topographical_moon_1.png', 'quality': 3},
'fractal islands': {'file': 'images/prerendered/fractal_islands.png', 'thumbnail': 'images/prerendered/th/fractal_islands.png', 'quality': 1},
'Genison': {'file': 'images/prerendered/Genison.png', 'thumbnail': 'images/prerendered/th/Genison.png', 'quality': 1},
'green farming alien world 1': {'file': 'images/prerendered/green_farming_alien_world_1.png', 'thumbnail': 'images/prerendered/th/green_farming_alien_world_1.png', 'quality': 3},
'green farming alien world 2': {'file': 'images/prerendered/green_farming_alien_world_2.png', 'thumbnail': 'images/prerendered/th/green_farming_alien_world_2.png', 'quality': 3},
'grey barren alien world 1': {'file': 'images/prerendered/grey_barren_alien_world_1.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_1.png', 'quality': 3},
'grey barren alien world 2': {'file': 'images/prerendered/grey_barren_alien_world_2.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_2.png', 'quality': 3},
'grey barren alien world 3': {'file': 'images/prerendered/grey_barren_alien_world_3.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_3.png', 'quality': 3},
'grey barren alien world 4': {'file': 'images/prerendered/grey_barren_alien_world_4.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_4.png', 'quality': 3},
'grey barren alien world 5': {'file': 'images/prerendered/grey_barren_alien_world_5.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_5.png', 'quality': 3},
'grey barren alien world 6': {'file': 'images/prerendered/grey_barren_alien_world_6.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_6.png', 'quality': 3},
'grey barren alien world 7': {'file': 'images/prerendered/grey_barren_alien_world_7.png', 'thumbnail': 'images/prerendered/th/grey_barren_alien_world_7.png', 'quality': 3},
'grey waterless alien world map': {'file': 'images/prerendered/grey_waterless_alien_world_map.png', 'thumbnail': 'images/prerendered/th/grey_waterless_alien_world_map.png', 'quality': 3},
'grid 1': {'file': 'images/prerendered/grid_1.png', 'thumbnail': 'images/prerendered/th/grid_1.png', 'quality': 0},
'Hex gen map': {'file': 'images/prerendered/Hex_gen_map.png', 'thumbnail': 'images/prerendered/th/Hex_gen_map.png', 'quality': 0},
'hex grass dirty': {'file': 'images/prerendered/hex_grass_dirty.png', 'thumbnail': 'images/prerendered/th/hex_grass_dirty.png', 'quality': 0},
'hex military industrial alien world map': {'file': 'images/prerendered/hex_military_industrial_alien_world_map.png', 'thumbnail': 'images/prerendered/th/hex_military_industrial_alien_world_map.png', 'quality': 3},
'hex mixed elevations battlefield 1': {'file': 'images/prerendered/hex_mixed_elevations_battlefield_1.png', 'thumbnail': 'images/prerendered/th/hex_mixed_elevations_battlefield_1.png', 'quality': 0},
'hex mixed elevations battlefield 2': {'file': 'images/prerendered/hex_mixed_elevations_battlefield_2.png', 'thumbnail': 'images/prerendered/th/hex_mixed_elevations_battlefield_2.png', 'quality': 0},
'hex tree territory': {'file': 'images/prerendered/hex_tree_territory.png', 'thumbnail': 'images/prerendered/th/hex_tree_territory.png', 'quality': 3},
'lake city': {'file': 'images/prerendered/lake_city.png', 'thumbnail': 'images/prerendered/th/lake_city.png', 'quality': 2},
'mickey lagoon': {'file': 'images/prerendered/mickey_lagoon.png', 'thumbnail': 'images/prerendered/th/mickey_lagoon.png', 'quality': 1},
'mixed elevations battlefield 3': {'file': 'images/prerendered/mixed_elevations_battlefield_3.png', 'thumbnail': 'images/prerendered/th/mixed_elevations_battlefield_3.png', 'quality': 0},
'n6W9Hc': {'file': 'images/prerendered/n6W9Hc.png', 'thumbnail': 'images/prerendered/th/n6W9Hc.png', 'quality': 1},
'oasis mixed elevations 1': {'file': 'images/prerendered/oasis_mixed_elevations_1.png', 'thumbnail': 'images/prerendered/th/oasis_mixed_elevations_1.png', 'quality': 0},
'pic526383': {'file': 'images/prerendered/pic526383.png', 'thumbnail': 'images/prerendered/th/pic526383.png', 'quality': 0},
'pinecone islands': {'file': 'images/prerendered/pinecone_islands.png', 'thumbnail': 'images/prerendered/th/pinecone_islands.png', 'quality': 1},
'purple pines': {'file': 'images/prerendered/purple_pines.png', 'thumbnail': 'images/prerendered/th/purple_pines.png', 'quality': 0},
'red volcanic alien 1': {'file': 'images/prerendered/red_volcanic_alien_1.png', 'thumbnail': 'images/prerendered/th/red_volcanic_alien_1.png', 'quality': 3},
'red volcanic alien 2': {'file': 'images/prerendered/red_volcanic_alien_2.png', 'thumbnail': 'images/prerendered/th/red_volcanic_alien_2.png', 'quality': 3},
'red volcanic alien 3': {'file': 'images/prerendered/red_volcanic_alien_3.png', 'thumbnail': 'images/prerendered/th/red_volcanic_alien_3.png', 'quality': 3},
'red volcanic alien 4': {'file': 'images/prerendered/red_volcanic_alien_4.png', 'thumbnail': 'images/prerendered/th/red_volcanic_alien_4.png', 'quality': 3},
'roadway 1': {'file': 'images/prerendered/roadway_1.png', 'thumbnail': 'images/prerendered/th/roadway_1.png', 'quality': 0},
'snowy lake': {'file': 'images/prerendered/snowy_lake.png', 'thumbnail': 'images/prerendered/th/snowy_lake.png', 'quality': 0},
'snowy rolling hills 1': {'file': 'images/prerendered/snowy_rolling_hills_1.png', 'thumbnail': 'images/prerendered/th/snowy_rolling_hills_1.png', 'quality': 0},
'volcanic alien world map': {'file': 'images/prerendered/volcanic_alien_world_map.png', 'thumbnail': 'images/prerendered/th/volcanic_alien_world_map.png', 'quality': 3},
'war torn post apocalyptic alien world map': {'file': 'images/prerendered/war_torn_post_apocalyptic_alien_world_map.png', 'thumbnail': 'images/prerendered/th/war_torn_post_apocalyptic_alien_world_map.png', 'quality': 3},
}
pre_rendered_maps_paths = [
map_file['file'].replace("\\", "/")
for map_name, map_file in sorted(
PRE_RENDERED_MAPS_JSON_LEVELS.items(),
key=lambda x: (
x[1]['quality'],
''.join(char.lower() for char in x[0] if char.isalnum())
)
)
]
pre_rendered_maps_paths_api_file = [f"./gradio_api/file={map_path}" for map_path in pre_rendered_maps_paths]
# Available FLUX model names
MODELS = [
"black-forest-labs/FLUX.1-schnell",
"black-forest-labs/FLUX.1-dev",
"ostris/Flex.1-alpha",
"black-forest-labs/FLUX.1-Fill-dev"
]
# Available LoRA weights
LORA_WEIGHTS = [
"Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design",
"Shakker-Labs/FLUX.1-dev-LoRA-Micro-landscape-on-Mobile-Phone",
"Borcherding/FLUX.1-dev-LoRA-FractalLand-v0.1",
"Cossale/Frames2-Flex.1",
"AlekseyCalvin/HSTcolorFlexAlpha",
"XLabs-AI/flux-lora-collection/anime_lora.safetensors",
"XLabs-AI/flux-lora-collection/scenery_lora.safetensors",
"XLabs-AI/flux-lora-collection/disney_lora.safetensors",
"XLabs-AI/flux-RealismLora",
"strangerzonehf/Flux-Cute-3D-Kawaii-LoRA",
"SebastianBodza/flux_cute3D",
"gokaygokay/Flux-Seamless-Texture-LoRA",
"gokaygokay/Flux-Game-Assets-LoRA-v2",
"lrzjason/ObjectRemovalFluxFill",
]
# Map each LoRA weight to its corresponding model
LORA_TO_MODEL = {
"Yuanshi/OminiControl": "black-forest-labs/FLUX.1-schnell",
"Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design": "black-forest-labs/FLUX.1-dev",
"Shakker-Labs/FLUX.1-dev-LoRA-Micro-landscape-on-Mobile-Phone": "black-forest-labs/FLUX.1-dev",
"Borcherding/FLUX.1-dev-LoRA-FractalLand-v0.1": "black-forest-labs/FLUX.1-dev",
"Cossale/Frames2-Flex.1": "ostris/Flex.1-alpha",
"AlekseyCalvin/HSTcolorFlexAlpha": "ostris/Flex.1-alpha",
"XLabs-AI/flux-lora-collection/anime_lora.safetensors":"black-forest-labs/FLUX.1-dev",
"XLabs-AI/flux-lora-collection/scenery_lora.safetensors":"black-forest-labs/FLUX.1-dev",
"XLabs-AI/flux-lora-collection/disney_lora.safetensors":"black-forest-labs/FLUX.1-dev",
"XLabs-AI/flux-RealismLora":"black-forest-labs/FLUX.1-dev",
"strangerzonehf/Flux-Cute-3D-Kawaii-LoRA":"black-forest-labs/FLUX.1-dev",
"SebastianBodza/flux_cute3D":"black-forest-labs/FLUX.1-dev",
"gokaygokay/Flux-Seamless-Texture-LoRA":"black-forest-labs/FLUX.1-dev",
"gokaygokay/Flux-Game-Assets-LoRA-v2":"black-forest-labs/FLUX.1-dev",
"lrzjason/ObjectRemovalFluxFill":"black-forest-labs/FLUX.1-Fill-dev",
}
condition_type = ["depth", "canny", "subject", "coloring", "deblurring", "fill", "redux"]
# Detailed LoRA weight configurations
LORA_DETAILS = {
"AlekseyCalvin/HSTcolorFlexAlpha" : [
{
"trigger_words": "(6kStepsCkpt)HST style analog autochrome photo ",
},
{
"weight_name": "HSToricColorFlex_6000steps_LoRAforFluxOrFlex_32dim64alpha.safetensors",
},
{
"notes": "We use (6kStepsCkpt)HST style analog autochrome photo as trigger words."
},
{
"title": "HSToric Color Flex",
},
{
"parameters" :{
"num_inference_steps": "30"
}
},
{
"thumbnail": "https://huggingface.co/AlekseyCalvin/HSTcolorFlexAlpha/resolve/main/images/example_gypubjtqx.png",
"show_in_gallery": True
}
],
"XLabs-AI/flux-lora-collection/anime_lora.safetensors":[
{
"lora_collection": "XLabs-AI/flux-lora-collection",
"weight_name": "anime_lora.safetensors"
},
{
"trigger_words": "anime,",
},
{
"title": "Anime",
},
{
"notes": "You should use ',anime' as trigger words at the end. "
},
{
"parameters" :{
"num_inference_steps": "30"
}
},
{
"thumbnail": "https://github.com/XLabs-AI/x-flux/blob/main/assets/readme/examples/result_14.png?raw=true",
"show_in_gallery": True
}
],
"XLabs-AI/flux-lora-collection/scenery_lora.safetensors":[
{
"lora_collection": "XLabs-AI/flux-lora-collection",
"weight_name": "scenery_lora.safetensors"
},
{
"trigger_words": "scenery style,",
},
{
"title": "Scenery",
},
{
"notes": "You should use ',scenery style' as trigger words at the end. "
},
{
"parameters" :{
"num_inference_steps": "30"
}
},
{
"thumbnail": "https://github.com/XLabs-AI/x-flux/blob/main/assets/readme/examples/result_21.png?raw=true",
"show_in_gallery": True
}
],
"XLabs-AI/flux-lora-collection/disney_lora.safetensors":[
{
"lora_collection": "XLabs-AI/flux-lora-collection",
"weight_name": "disney_lora.safetensors"
},
{
"trigger_words": "disney style,",
},
{
"title": "Disney Style",
},
{
"notes": "You should use ',disney style' as trigger words at the end. "
},
{
"parameters" :{
"num_inference_steps": "30"
}
},
{
"thumbnail": "https://github.com/XLabs-AI/x-flux/blob/main/assets/readme/examples/result_19.png?raw=true",
"show_in_gallery": True
}
],
"XLabs-AI/flux-RealismLora":[
{
"notes": "No trigger words but 8k, Animatrix illustration style, fantasy style, natural photo cinematic should all work "
},
{
"title": "Realism",
},
{
"parameters" :{
"guidance_scale": "3.2",
"num_inference_steps": "34",
"scale": "0.85"
}
},
{
"thumbnail": "https://huggingface.co/VideoAditor/Flux-Lora-Realism/resolve/main/images/feel-the-difference-between-using-flux-with-lora-from-xlab-v0-j0ehybmvxehd1.png",
"show_in_gallery": True
}
],
"Cossale/Frames2-Flex.1": [
{
"weight_name": "backdrops_v2.safetensors",
"adapter_name": "backdrops_v2"
},
{
"trigger_words": "FRM$",
},
{
"title": "Frames2-Flex.1",
},
{
"notes": " FRM$ used as trigger words. "
},
{
"parameters" :{
"num_inference_steps": "50"
}
},
{
"thumbnail": "https://huggingface.co/Cossale/Frames2-Flex.1/resolve/main/samples/1737567472380__000005000_2.jpg",
"show_in_gallery": True
}
],
"Yuanshi/OminiControl": [
{
"weight_name": "omini/subject_512.safetensors",
"adapter_name": "subject_512"
},
{
"weight_name": "omini/subject_1024_beta.safetensors",
"adapter_name": "subject_1024"
},
{
"trigger_words": "omini,",
},
{
"parameters" :{
"num_inference_steps": "8",
"guidance_scale": "0"
}
},
{
"notes": "Select an Image as a guide."
},
{
"thumbnail": "",
"show_in_gallery": False
}
],
"Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design": [
{
"notes": "Uses wablogo, logo, Minimalist as trigger words.."
},
{
"trigger_words": "wablogo, logo, Minimalist ",
},
{
"title": "Logo Design",
},
{
"pipe" :{
"fuse_lora": {"lora_scale":0.8}
}
},
{
"parameters" :{
"num_inference_steps": "38"
}
},
{
"thumbnail": "https://huggingface.co/Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design/resolve/main/images/73e7db6a33550d05836ce285549de60075d05373c7b0660d631dac33.jpg",
"show_in_gallery": True
}
],
"Shakker-Labs/FLUX.1-dev-LoRA-Micro-landscape-on-Mobile-Phone": [
{
"notes": "Uses miniature stereoscopic scene as trigger words.."
},
{
"trigger_words": "miniature stereoscopic scene ",
},
{
"title": "Micro Landscape",
},
{
"weight_name": "FLUX-dev-lora-micro-landscape.safetensors",
},
{
"pipe" :{
"fuse_lora": {"lora_scale":0.7}
}
},
{
"parameters" :{
"guidance_scale": "3.5",
"num_inference_steps": "24",
"scale": "0.72",
}
},
{
"thumbnail": "https://huggingface.co/Shakker-Labs/FLUX.1-dev-LoRA-Micro-landscape-on-Mobile-Phone/resolve/main/images/c4f5c765bc8d3d396ed13d65666895ab23ada35c78ca6d91bf814613.jpg",
"show_in_gallery": True
}
],
"Borcherding/FLUX.1-dev-LoRA-FractalLand-v0.1": [
{
"notes": "Uses fractalLand at the start of the prompts to activate the fractal elements. . "
},
{
"trigger_words": "fractalLand ",
},
{
"title": "fractalLand",
},
{
"parameters" :{
"max_sequence_length": "512",
"guidance_scale": "3.5",
"num_inference_steps": "38"
}
},
{
"thumbnail": "https://huggingface.co/Borcherding/FLUX.1-dev-LoRA-FractalLand-v0.1/resolve/main/images/example_e2zoqwftv.png",
"show_in_gallery": True
}
],
"strangerzonehf/Flux-Cute-3D-Kawaii-LoRA": [
{
"weight_name": "Cute-3d-Kawaii.safetensors",
},
{
"notes": "Uses Cute 3d Kawaii at the start of the prompts "
},
{
"trigger_words": "Cute 3d Kawaii ",
},
{
"title": "Cute 3D Kawaii",
},
{
"parameters" :{
"height": "1024"
}
},
{
"thumbnail": "https://huggingface.co/strangerzonehf/Flux-Cute-3D-Kawaii-LoRA/resolve/main/images/CK3.png",
"show_in_gallery": True
}
],
"SebastianBodza/flux_cute3D": [
{
"notes": "Uses NEOCUTE3D at the start of the prompts "
},
{
"trigger_words": "NEOCUTE3D ",
},
{
"title": "Cute 3D",
},
{
"thumbnail": "https://huggingface.co/SebastianBodza/flux_cute3D/resolve/main/images/astronaut.webp",
"show_in_gallery": True
}
],
"gokaygokay/Flux-Seamless-Texture-LoRA": [
{
"notes": "Uses smlstxtr at the start of the prompts "
},
{
"weight_name": "seamless_texture.safetensors",
},
{
"trigger_words": "smlstxtr ",
},
{
"title": "Seamless Texture",
},
{
"thumbnail": "https://huggingface.co/gokaygokay/Flux-Seamless-Texture-LoRA/resolve/main/images/image3.jpg",
"show_in_gallery": True
}
],
"gokaygokay/Flux-Game-Assets-LoRA-v2": [
{
"notes": "Uses wbgmsst, white background at the start of the prompts "
},
{
"trigger_words": "wbgmsst, white background ",
},
{
"title": "Game Assets",
},
{
"thumbnail": "https://huggingface.co/gokaygokay/Flux-Game-Assets-LoRA-v2/resolve/main/images/example_y2bqpuphc.png",
"show_in_gallery": True
}
],
"lrzjason/ObjectRemovalFluxFill":[
{
"notes": "Used to remove objects, may leave a blur "
},
{
"weight_name": "objectRemovalv1_r32.safetensors",
},
{
"title": "Object Removal",
},
{
"parameters" :{
"guidance_scale": "30",
"num_inference_steps": "50",
"max_sequence_length": "512"
}
},
{
"thumbnail": "images/prerendered/th/object_removal.png",
"show_in_gallery": False
}
],
}
def sort_loras(sortby):
loras = []
for key, details in LORA_DETAILS.items():
lora_info = {
"image": "",
"title": "",
"repo": key,
"weights": "",
"trigger_word": "",
"notes": ""
}
for item in details:
if "thumbnail" in item:
lora_info["image"] = item.get("thumbnail", "")
if "weight_name" in item:
lora_info["weights"] = item.get("weight_name", "")
if "trigger_words" in item:
lora_info["trigger_word"] = item.get("trigger_words", "")
if "notes" in item:
lora_info["notes"] = item.get("notes", "")
if "title" in item:
lora_info["title"] = item.get("title", "")
# Default title to key if not provided
if not lora_info["title"]:
lora_info["title"] = key
# Only add to gallery if flagged "show_in_gallery" = True
if any(item.get("show_in_gallery", False) for item in details):
if lora_info["image"] == "":
lora_info["image"] = "images/Beeuty-1.png"
loras.append(lora_info)
# Add models from the MODELS list with a default thumbnail
for model in MODELS:
loras.append({
"image": f"images/prerendered/th/"+ model.split("/")[-1]+".png",
"title": model.split("/")[-1],
"repo": model,
"weights": "",
"trigger_word": "",
"notes": ""
})
# Sort the loras list by the title attribute
loras = sorted(loras, key=lambda x: x[sortby])
loras.append({
"image": f"images/images/Bee-test-2.png",
"title": "Manual Entry",
"repo": "Manual Entry",
"weights": "",
"trigger_word": "",
"notes": ""
})
return loras
LORAS = sort_loras("title")
# Read the contents of the LUT folder, output to a list
lut_folder = "./LUT"
lut_files = [os.path.join(lut_folder, f).replace("\\", "/") for f in os.listdir(lut_folder) if f.endswith(".cube")]
temp_files = []
cards = [
"2♥️", "3♥️", "4♥️", "5♥️", "6♥️", "7♥️", "8♥️", "9♥️", "10♥️", "J♥️", "Q♥️", "K♥️", "A♥️",
"2♦️", "3♦️", "4♦️", "5♦️", "6♦️", "7♦️", "8♦️", "9♦️", "10♦️", "J♦️", "Q♦️", "K♦️", "A♦️",
"2♣️", "3♣️", "4♣️", "5♣️", "6♣️", "7♣️", "8♣️", "9♣️", "10♣️", "J♣️", "Q♣️", "K♣️", "A♣️",
"2♠️", "3♠️", "4♠️", "5♠️", "6♠️", "7♠️", "8♠️", "9♠️", "10♠️", "J♠️", "Q♠️", "K♠️", "A♠️"
]
cards_alternating = [
"2♥️", "3♥️", "4♥️", "5♥️", "6♥️", "7♥️", "8♥️", "9♥️", "10♥️", "J♥️", "Q♥️", "K♥️", "A♥️",
"2♣️", "3♣️", "4♣️", "5♣️", "6♣️", "7♣️", "8♣️", "9♣️", "10♣️", "J♣️", "Q♣️", "K♣️", "A♣️",
"2♦️", "3♦️", "4♦️", "5♦️", "6♦️", "7♦️", "8♦️", "9♦️", "10♦️", "J♦️", "Q♦️", "K♦️", "A♦️",
"2♠️", "3♠️", "4♠️", "5♠️", "6♠️", "7♠️", "8♠️", "9♠️", "10♠️", "J♠️", "Q♠️", "K♠️", "A♠️"
]
card_colors = [
"#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", # Hearts
"#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", # Diamonds
"#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", # Clubs
"#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000" # Spades
]
card_colors_alternating = [
"#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", # Hearts
"#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", # Clubs
"#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", "#FF0000", # Diamonds
"#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000" # Spades
] |