Spaces:
Running
on
Zero
Running
on
Zero
Update New Template Images system
Browse files- README.md +1 -1
- app.py +4 -4
- images/prerendered/BurntCity.png +3 -0
- images/prerendered/Genison.png +3 -0
- images/prerendered/cute3dkawaii.PNG +3 -0
- images/prerendered/donald_park.png +3 -0
- images/prerendered/fractal_islands.png +3 -0
- images/prerendered/{green_farming alien_world_1.png → green_farming_alien_world_1.png} +0 -0
- images/prerendered/{green_farming alien_world_2.png → green_farming_alien_world_2.png} +0 -0
- images/prerendered/{hex_military_industrial alien_world_map.png → hex_military_industrial_alien_world_map.png} +0 -0
- images/prerendered/hex_tree_territory.png +3 -0
- images/prerendered/lake_city.png +3 -0
- images/prerendered/mickey_lagoon.png +3 -0
- images/prerendered/pinecone_islands.png +3 -0
- images/prerendered/purple_pines.png +3 -0
- images/prerendered/snowy_lake.png +3 -0
- images/prerendered/{volcanic alien_world_map.png → volcanic_alien_world_map.png} +0 -0
- images/prerendered/{war-torn_post-apocalyptic_alien_world_map.png → war_torn_post_apocalyptic_alien_world_map.png} +0 -0
- utils/constants.py +8 -68
- utils/image_utils.py +21 -1
- utils/version_info.py +12 -11
README.md
CHANGED
@@ -5,7 +5,7 @@ colorFrom: yellow
|
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
python_version: 3.10.13
|
8 |
-
sdk_version: 5.16.
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
short_description: Transform Your Images into Mesmerizing Hexagon Grids
|
|
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
python_version: 3.10.13
|
8 |
+
sdk_version: 5.16.2
|
9 |
app_file: app.py
|
10 |
pinned: true
|
11 |
short_description: Transform Your Images into Mesmerizing Hexagon Grids
|
app.py
CHANGED
@@ -37,7 +37,6 @@ from utils.misc import (get_filename, pause, convert_ratio_to_dimensions) #insta
|
|
37 |
from utils.image_utils import (
|
38 |
change_color,
|
39 |
open_image,
|
40 |
-
build_prerendered_images,
|
41 |
upscale_image,
|
42 |
lerp_imagemath,
|
43 |
shrink_and_paste_on_blank,
|
@@ -47,7 +46,8 @@ from utils.image_utils import (
|
|
47 |
alpha_composite_with_control,
|
48 |
crop_and_resize_image,
|
49 |
convert_to_rgba_png,
|
50 |
-
resize_image_with_aspect_ratio
|
|
|
51 |
)
|
52 |
|
53 |
from utils.hex_grid import (
|
@@ -752,7 +752,7 @@ def create_3d_model(rgb_image, depth_array, voxel_size_factor=0.01, depth=10):
|
|
752 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
|
753 |
rgb_o3d,
|
754 |
depth_o3d,
|
755 |
-
convert_rgb_to_intensity=False
|
756 |
)
|
757 |
|
758 |
# Create a point cloud from the RGBD image
|
@@ -1059,7 +1059,7 @@ with gr.Blocks(css_paths="style_20250128.css", title=title, theme='Surn/beeuty')
|
|
1059 |
with gr.Row():
|
1060 |
with gr.Column(scale=2):
|
1061 |
# Gallery from PRE_RENDERED_IMAGES GOES HERE
|
1062 |
-
prerendered_image_gallery = gr.Gallery(label="Image Gallery", show_label=True, value=
|
1063 |
with gr.Column():
|
1064 |
image_guidance_stength = gr.Slider(label="Image Guidance Strength (prompt percentage)", minimum=0, maximum=1.0, value=0.8, step=0.01, interactive=True)
|
1065 |
replace_input_image_button = gr.Button(
|
|
|
37 |
from utils.image_utils import (
|
38 |
change_color,
|
39 |
open_image,
|
|
|
40 |
upscale_image,
|
41 |
lerp_imagemath,
|
42 |
shrink_and_paste_on_blank,
|
|
|
46 |
alpha_composite_with_control,
|
47 |
crop_and_resize_image,
|
48 |
convert_to_rgba_png,
|
49 |
+
resize_image_with_aspect_ratio,
|
50 |
+
build_prerendered_images_by_quality
|
51 |
)
|
52 |
|
53 |
from utils.hex_grid import (
|
|
|
752 |
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
|
753 |
rgb_o3d,
|
754 |
depth_o3d,
|
755 |
+
convert_rgb_to_intensity=False,
|
756 |
)
|
757 |
|
758 |
# Create a point cloud from the RGBD image
|
|
|
1059 |
with gr.Row():
|
1060 |
with gr.Column(scale=2):
|
1061 |
# Gallery from PRE_RENDERED_IMAGES GOES HERE
|
1062 |
+
prerendered_image_gallery = gr.Gallery(label="Image Gallery", show_label=True, value=build_prerendered_images_by_quality(1), elem_id="gallery", elem_classes="solid", type="filepath", columns=[3], rows=[3], preview=False ,object_fit="contain", height="auto", format="png",allow_preview=False)
|
1063 |
with gr.Column():
|
1064 |
image_guidance_stength = gr.Slider(label="Image Guidance Strength (prompt percentage)", minimum=0, maximum=1.0, value=0.8, step=0.01, interactive=True)
|
1065 |
replace_input_image_button = gr.Button(
|
images/prerendered/BurntCity.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/Genison.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/cute3dkawaii.PNG
ADDED
|
Git LFS Details
|
images/prerendered/donald_park.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/fractal_islands.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/{green_farming alien_world_1.png → green_farming_alien_world_1.png}
RENAMED
File without changes
|
images/prerendered/{green_farming alien_world_2.png → green_farming_alien_world_2.png}
RENAMED
File without changes
|
images/prerendered/{hex_military_industrial alien_world_map.png → hex_military_industrial_alien_world_map.png}
RENAMED
File without changes
|
images/prerendered/hex_tree_territory.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/lake_city.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/mickey_lagoon.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/pinecone_islands.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/purple_pines.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/snowy_lake.png
ADDED
![]() |
Git LFS Details
|
images/prerendered/{volcanic alien_world_map.png → volcanic_alien_world_map.png}
RENAMED
File without changes
|
images/prerendered/{war-torn_post-apocalyptic_alien_world_map.png → war_torn_post_apocalyptic_alien_world_map.png}
RENAMED
File without changes
|
utils/constants.py
CHANGED
@@ -67,85 +67,25 @@ NEGATIVE_PROMPTS = {
|
|
67 |
}
|
68 |
|
69 |
# Directory containing the pre-rendered hexagon maps
|
70 |
-
|
71 |
|
72 |
# List of pre-rendered hexagon map files
|
73 |
-
PRE_RENDERED_MAPS = [
|
74 |
-
"alien_orb_land_1.png",
|
75 |
-
"alien_prarie_1.png",
|
76 |
-
"alien_world_1.png",
|
77 |
-
"alien_world_2.png",
|
78 |
-
"alien_world_3.png",
|
79 |
-
"alien_world_4.png",
|
80 |
-
"alien_world_5.png",
|
81 |
-
"canyon_water_1.png",
|
82 |
-
"CONQ_Caustic_Valley.png",
|
83 |
-
"CONQ_Frozen_City.png",
|
84 |
-
"CONQ_Hellebore_Springs.png",
|
85 |
-
"CONQ_Terra_Therma.png",
|
86 |
-
"CONQ_Viridian_Bog.png",
|
87 |
-
"dark_dirt_elevations_1.png",
|
88 |
-
"elevated_peninsula_1.png",
|
89 |
-
"Firefly_alien_canyons_1.png",
|
90 |
-
"Firefly_alien_canyons_2.png",
|
91 |
-
"Firefly_alien_canyons_2.png",
|
92 |
-
"Firefly_alien_dry_canyons_1.png",
|
93 |
-
"Firefly_alien_dry_canyons_2.png",
|
94 |
-
"Firefly_alien_map_1.png",
|
95 |
-
"Firefly_hpg_terrain_1.png",
|
96 |
-
"Firefly_hpg_terrain_2.png",
|
97 |
-
"Firefly_river_dry_1.png",
|
98 |
-
"Firefly_river_running_1.png",
|
99 |
-
"Firefly_topographical_alien_desert_1.png",
|
100 |
-
"Firefly_topographical_canyon_1.png",
|
101 |
-
"Firefly_topographical_height_map_1.png",
|
102 |
-
"Firefly_topographical_height_map_2.png",
|
103 |
-
"Firefly_topographical_height_map_3.png",
|
104 |
-
"Firefly_topographical_height_map_5.png",
|
105 |
-
"Firefly_topographical_height_map_6.png",
|
106 |
-
"Firefly_topographical_marble_1.png",
|
107 |
-
"Firefly_topographical_moon_1.png",
|
108 |
-
"green_farming alien_world_1.png",
|
109 |
-
"green_farming alien_world_2.png",
|
110 |
-
"grey_barren_alien_world_1.png",
|
111 |
-
"grey_barren_alien_world_2.png",
|
112 |
-
"grey_barren_alien_world_3.png",
|
113 |
-
"grey_barren_alien_world_4.png",
|
114 |
-
"grey_barren_alien_world_5.png",
|
115 |
-
"grey_barren_alien_world_6.png",
|
116 |
-
"grey_barren_alien_world_7.png",
|
117 |
-
"grey_waterless_alien_world_map.png",
|
118 |
-
"grid_1.png",
|
119 |
-
"Hex_gen_map.PNG",
|
120 |
-
"hex_grass_dirty.png",
|
121 |
-
"hex_military_industrial alien_world_map.png",
|
122 |
-
"hex_mixed_elevations_battlefield_1.png",
|
123 |
-
"hex_mixed_elevations_battlefield_2.png",
|
124 |
-
"mixed_elevations_battlefield_3.png",
|
125 |
-
"n6W9Hc.png",
|
126 |
-
"oasis_mixed_elevations_1.png",
|
127 |
-
"pic526383.png",
|
128 |
-
"red_volcanic_alien_1.png",
|
129 |
-
"red_volcanic_alien_2.png",
|
130 |
-
"red_volcanic_alien_3.png",
|
131 |
-
"red_volcanic_alien_4.png",
|
132 |
-
"roadway_1.png",
|
133 |
-
"snowy_rolling_hills_1.png",
|
134 |
-
"volcanic alien_world_map.png",
|
135 |
-
"war-torn_post-apocalyptic_alien_world_map.png"
|
136 |
-
]
|
137 |
|
138 |
# Create full paths for pre-rendered maps
|
139 |
-
pre_rendered_maps_paths = [os.path.join(
|
140 |
pre_rendered_maps_paths_api_file = [f"./gradio_api/file={map_path}" for map_path in pre_rendered_maps_paths]
|
141 |
|
142 |
# Generate a dictionary with cleaned-up names as keys and file paths as values
|
143 |
PRE_RENDERED_MAPS_JSON = {
|
144 |
-
os.path.splitext(file.replace("_", " ").replace("-", " ").replace(" ", " ").strip())[0]: os.path.join(
|
145 |
for file in PRE_RENDERED_MAPS
|
146 |
}
|
|
|
|
|
|
|
|
|
147 |
|
148 |
-
PRE_RENDERED_MAPS_JSON = "{'alien world 1': 'images/prerendered/alien_world_1.jpg', 'alien world 2': 'images/prerendered/alien_world_2.jpg', 'alien world 3': 'images/prerendered/alien_world_3.jpg', 'alien world 4': 'images/prerendered/alien_world_4.jpg', 'alien world 5': 'images/prerendered/alien_world_5.jpg', 'green farming alien world 1': 'images/prerendered/green_farming alien_world_1.jpg', 'green farming alien world 2': 'images/prerendered/green_farming alien_world_2.jpg', 'grey barren alien world 1': 'images/prerendered/grey_barren_alien_world_1.jpg', 'grey barren alien world 2': 'images/prerendered/grey_barren_alien_world_2.jpg', 'grey barren alien world 3': 'images/prerendered/grey_barren_alien_world_3.jpg', 'grey barren alien world 4': 'images/prerendered/grey_barren_alien_world_4.jpg', 'grey barren alien world 5': 'images/prerendered/grey_barren_alien_world_5.jpg', 'grey barren alien world 6': 'images/prerendered/grey_barren_alien_world_6.jpg', 'grey barren alien world 7': 'images/prerendered/grey_barren_alien_world_7.jpg', 'grey waterless alien world map': 'images/prerendered/grey_waterless_alien_world_map.jpg', 'Hex gen map': 'images/prerendered/Hex_gen_map.PNG', 'military industrial alien world map': 'images/prerendered/military_industrial alien_world_map.jpg', 'red volcanic alien 1': 'images/prerendered/red_volcanic_alien_1.jpg', 'red volcanic alien 2': 'images/prerendered/red_volcanic_alien_2.jpg', 'red volcanic alien 3': 'images/prerendered/red_volcanic_alien_3.jpg', 'red volcanic alien 4': 'images/prerendered/red_volcanic_alien_4.jpg', 'volcanic alien world map': 'images/prerendered/volcanic alien_world_map.jpg', 'war torn post apocalyptic alien world map': 'images/prerendered/war-torn_post-apocalyptic_alien_world_map.jpg'}"
|
149 |
# Available FLUX model names
|
150 |
MODELS = [
|
151 |
"black-forest-labs/FLUX.1-schnell",
|
|
|
67 |
}
|
68 |
|
69 |
# Directory containing the pre-rendered hexagon maps
|
70 |
+
PRERENDER_DIR = "images/prerendered"
|
71 |
|
72 |
# List of pre-rendered hexagon map files
|
73 |
+
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']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
# Create full paths for pre-rendered maps
|
76 |
+
pre_rendered_maps_paths = [os.path.join(PRERENDER_DIR, map_file).replace("\\", "/") for map_file in PRE_RENDERED_MAPS]
|
77 |
pre_rendered_maps_paths_api_file = [f"./gradio_api/file={map_path}" for map_path in pre_rendered_maps_paths]
|
78 |
|
79 |
# Generate a dictionary with cleaned-up names as keys and file paths as values
|
80 |
PRE_RENDERED_MAPS_JSON = {
|
81 |
+
os.path.splitext(file.replace("_", " ").replace("-", " ").replace(" ", " ").strip())[0]: os.path.join(PRERENDER_DIR, file)
|
82 |
for file in PRE_RENDERED_MAPS
|
83 |
}
|
84 |
+
PRE_RENDERED_MAPS_JSON
|
85 |
+
{'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'}
|
86 |
+
##PRE_RENDERED_MAPS_JSON = { key: { 'file': value, 'quality': 0 } for key, value in PRE_RENDERED_MAPS_JSON.items()}
|
87 |
+
PRE_RENDERED_MAPS_JSON_LEVELS = {'alien orb land 1': {'file': 'images/prerendered/alien_orb_land_1.png', 'quality': 0}, 'alien prarie 1': {'file': 'images/prerendered/alien_prarie_1.png', 'quality': 0}, 'alien world 1': {'file': 'images/prerendered/alien_world_1.png', 'quality': 0}, 'alien world 2': {'file': 'images/prerendered/alien_world_2.png', 'quality': 0}, 'alien world 3': {'file': 'images/prerendered/alien_world_3.png', 'quality': 0}, 'alien world 4': {'file': 'images/prerendered/alien_world_4.png', 'quality': 0}, 'alien world 5': {'file': 'images/prerendered/alien_world_5.png', 'quality': 0}, 'BurntCity': {'file': 'images/prerendered/BurntCity.png', 'quality': 0}, 'canyon water 1': {'file': 'images/prerendered/canyon_water_1.png', 'quality': 0}, 'CONQ Caustic Valley': {'file': 'images/prerendered/CONQ_Caustic_Valley.png', 'quality': 0}, 'CONQ Frozen City': {'file': 'images/prerendered/CONQ_Frozen_City.png', 'quality': 0}, 'CONQ Hellebore Springs': {'file': 'images/prerendered/CONQ_Hellebore_Springs.png', 'quality': 0}, 'CONQ Terra Therma': {'file': 'images/prerendered/CONQ_Terra_Therma.png', 'quality': 0}, 'CONQ Viridian Bog': {'file': 'images/prerendered/CONQ_Viridian_Bog.png', 'quality': 0}, 'cute3dkawaii': {'file': 'images/prerendered/cute3dkawaii.PNG', 'quality': 0}, 'dark dirt elevations 1': {'file': 'images/prerendered/dark_dirt_elevations_1.png', 'quality': 0}, 'donald park': {'file': 'images/prerendered/donald_park.png', 'quality': 0}, 'elevated peninsula 1': {'file': 'images/prerendered/elevated_peninsula_1.png', 'quality': 0}, 'Firefly alien canyons 1': {'file': 'images/prerendered/Firefly_alien_canyons_1.png', 'quality': 0}, 'Firefly alien canyons 2': {'file': 'images/prerendered/Firefly_alien_canyons_2.png', 'quality': 0}, 'Firefly alien dry canyons 1': {'file': 'images/prerendered/Firefly_alien_dry_canyons_1.png', 'quality': 0}, 'Firefly alien dry canyons 2': {'file': 'images/prerendered/Firefly_alien_dry_canyons_2.png', 'quality': 0}, 'Firefly alien map 1': {'file': 'images/prerendered/Firefly_alien_map_1.png', 'quality': 0}, 'Firefly hpg terrain 1': {'file': 'images/prerendered/Firefly_hpg_terrain_1.png', 'quality': 0}, 'Firefly hpg terrain 2': {'file': 'images/prerendered/Firefly_hpg_terrain_2.png', 'quality': 0}, 'Firefly river dry 1': {'file': 'images/prerendered/Firefly_river_dry_1.png', 'quality': 0}, 'Firefly river running 1': {'file': 'images/prerendered/Firefly_river_running_1.png', 'quality': 0}, 'Firefly topographical alien desert 1': {'file': 'images/prerendered/Firefly_topographical_alien_desert_1.png', 'quality': 0}, 'Firefly topographical canyon 1': {'file': 'images/prerendered/Firefly_topographical_canyon_1.png', 'quality': 0}, 'Firefly topographical height map 1': {'file': 'images/prerendered/Firefly_topographical_height_map_1.png', 'quality': 0}, 'Firefly topographical height map 2': {'file': 'images/prerendered/Firefly_topographical_height_map_2.png', 'quality': 0}, 'Firefly topographical height map 3': {'file': 'images/prerendered/Firefly_topographical_height_map_3.png', 'quality': 0}, 'Firefly topographical height map 5': {'file': 'images/prerendered/Firefly_topographical_height_map_5.png', 'quality': 0}, 'Firefly topographical height map 6': {'file': 'images/prerendered/Firefly_topographical_height_map_6.png', 'quality': 0}, 'Firefly topographical marble 1': {'file': 'images/prerendered/Firefly_topographical_marble_1.png', 'quality': 0}, 'Firefly topographical moon 1': {'file': 'images/prerendered/Firefly_topographical_moon_1.png', 'quality': 0}, 'fractal islands': {'file': 'images/prerendered/fractal_islands.png', 'quality': 0}, 'Genison': {'file': 'images/prerendered/Genison.png', 'quality': 0}, 'green farming alien world 1': {'file': 'images/prerendered/green_farming_alien_world_1.png', 'quality': 0}, 'green farming alien world 2': {'file': 'images/prerendered/green_farming_alien_world_2.png', 'quality': 0}, 'grey barren alien world 1': {'file': 'images/prerendered/grey_barren_alien_world_1.png', 'quality': 0}, 'grey barren alien world 2': {'file': 'images/prerendered/grey_barren_alien_world_2.png', 'quality': 0}, 'grey barren alien world 3': {'file': 'images/prerendered/grey_barren_alien_world_3.png', 'quality': 0}, 'grey barren alien world 4': {'file': 'images/prerendered/grey_barren_alien_world_4.png', 'quality': 0}, 'grey barren alien world 5': {'file': 'images/prerendered/grey_barren_alien_world_5.png', 'quality': 0}, 'grey barren alien world 6': {'file': 'images/prerendered/grey_barren_alien_world_6.png', 'quality': 0}, 'grey barren alien world 7': {'file': 'images/prerendered/grey_barren_alien_world_7.png', 'quality': 0}, 'grey waterless alien world map': {'file': 'images/prerendered/grey_waterless_alien_world_map.png', 'quality': 0}, 'grid 1': {'file': 'images/prerendered/grid_1.png', 'quality': 0}, 'Hex gen map': {'file': 'images/prerendered/Hex_gen_map.PNG', 'quality': 0}, 'hex grass dirty': {'file': 'images/prerendered/hex_grass_dirty.png', 'quality': 0}, 'hex military industrial alien world map': {'file': 'images/prerendered/hex_military_industrial_alien_world_map.png', 'quality': 0}, 'hex mixed elevations battlefield 1': {'file': 'images/prerendered/hex_mixed_elevations_battlefield_1.png', 'quality': 0}, 'hex mixed elevations battlefield 2': {'file': 'images/prerendered/hex_mixed_elevations_battlefield_2.png', 'quality': 0}, 'hex tree territory': {'file': 'images/prerendered/hex_tree_territory.png', 'quality': 0}, 'lake city': {'file': 'images/prerendered/lake_city.png', 'quality': 0}, 'mickey lagoon': {'file': 'images/prerendered/mickey_lagoon.png', 'quality': 0}, 'mixed elevations battlefield 3': {'file': 'images/prerendered/mixed_elevations_battlefield_3.png', 'quality': 0}, 'n6W9Hc': {'file': 'images/prerendered/n6W9Hc.png', 'quality': 0}, 'oasis mixed elevations 1': {'file': 'images/prerendered/oasis_mixed_elevations_1.png', 'quality': 0}, 'pic526383': {'file': 'images/prerendered/pic526383.png', 'quality': 0}, 'pinecone islands': {'file': 'images/prerendered/pinecone_islands.png', 'quality': 0}, 'purple pines': {'file': 'images/prerendered/purple_pines.png', 'quality': 0}, 'red volcanic alien 1': {'file': 'images/prerendered/red_volcanic_alien_1.png', 'quality': 0}, 'red volcanic alien 2': {'file': 'images/prerendered/red_volcanic_alien_2.png', 'quality': 0}, 'red volcanic alien 3': {'file': 'images/prerendered/red_volcanic_alien_3.png', 'quality': 0}, 'red volcanic alien 4': {'file': 'images/prerendered/red_volcanic_alien_4.png', 'quality': 0}, 'roadway 1': {'file': 'images/prerendered/roadway_1.png', 'quality': 0}, 'snowy lake': {'file': 'images/prerendered/snowy_lake.png', 'quality': 0}, 'snowy rolling hills 1': {'file': 'images/prerendered/snowy_rolling_hills_1.png', 'quality': 0}, 'volcanic alien world map': {'file': 'images/prerendered/volcanic_alien_world_map.png', 'quality': 0}, 'war torn post apocalyptic alien world map': {'file': 'images/prerendered/war_torn_post_apocalyptic_alien_world_map.png', 'quality': 0}}
|
88 |
|
|
|
89 |
# Available FLUX model names
|
90 |
MODELS = [
|
91 |
"black-forest-labs/FLUX.1-schnell",
|
utils/image_utils.py
CHANGED
@@ -9,7 +9,7 @@ from PIL import Image, ImageChops, ImageDraw, ImageEnhance, ImageFilter, ImageDr
|
|
9 |
from typing import List, Union
|
10 |
#import math
|
11 |
from pathlib import Path
|
12 |
-
from utils.constants import default_lut_example_img
|
13 |
from utils.color_utils import (
|
14 |
detect_color_format,
|
15 |
update_color_opacity
|
@@ -77,6 +77,26 @@ def build_prerendered_images(images_list):
|
|
77 |
"""
|
78 |
return [open_image(image) for image in images_list]
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
def build_encoded_images(images_list):
|
81 |
"""
|
82 |
Encodes a list of images to base64 strings.
|
|
|
9 |
from typing import List, Union
|
10 |
#import math
|
11 |
from pathlib import Path
|
12 |
+
from utils.constants import default_lut_example_img, PRE_RENDERED_MAPS_JSON_LEVELS
|
13 |
from utils.color_utils import (
|
14 |
detect_color_format,
|
15 |
update_color_opacity
|
|
|
77 |
"""
|
78 |
return [open_image(image) for image in images_list]
|
79 |
|
80 |
+
# Example usage
|
81 |
+
# filtered_maps = get_maps_with_quality_less_than(3)
|
82 |
+
# print(filtered_maps)
|
83 |
+
def build_prerendered_images_by_quality(limit):
|
84 |
+
"""
|
85 |
+
Retrieve all file paths from PRE_RENDERED_MAPS_JSON_LEVELS where quality is less than the given limit.
|
86 |
+
|
87 |
+
Args:
|
88 |
+
limit (int): The quality threshold.
|
89 |
+
|
90 |
+
Returns:
|
91 |
+
list: A list of file paths meeting the quality criteria.
|
92 |
+
"""
|
93 |
+
images_list = [
|
94 |
+
map_info['file']
|
95 |
+
for map_info in PRE_RENDERED_MAPS_JSON_LEVELS.values()
|
96 |
+
if map_info['quality'] < limit
|
97 |
+
]
|
98 |
+
return build_prerendered_images(images_list)
|
99 |
+
|
100 |
def build_encoded_images(images_list):
|
101 |
"""
|
102 |
Encodes a list of images to base64 strings.
|
utils/version_info.py
CHANGED
@@ -59,16 +59,17 @@ def get_torch_info():
|
|
59 |
|
60 |
def release_torch_resources():
|
61 |
from torch import cuda
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
72 |
|
73 |
|
74 |
def initialize_cuda():
|
@@ -78,7 +79,7 @@ def initialize_cuda():
|
|
78 |
print(f"CUDA is available. Using device: {cuda.get_device_name(0)} with CUDA version: {version.cuda}")
|
79 |
result = "cuda"
|
80 |
else:
|
81 |
-
device = cuda.device("cpu")
|
82 |
print("CUDA is not available. Using CPU.")
|
83 |
result = "cpu"
|
84 |
return result
|
|
|
59 |
|
60 |
def release_torch_resources():
|
61 |
from torch import cuda
|
62 |
+
if cuda.is_available():
|
63 |
+
# Clear the CUDA cache
|
64 |
+
cuda.empty_cache()
|
65 |
+
cuda.ipc_collect()
|
66 |
+
# Delete any objects that are using GPU memory
|
67 |
+
#for obj in gc.get_objects():
|
68 |
+
# if is_tensor(obj) or (hasattr(obj, 'data') and is_tensor(obj.data)):
|
69 |
+
# del obj
|
70 |
+
# Run garbage collection
|
71 |
+
del cuda
|
72 |
+
gc.collect()
|
73 |
|
74 |
|
75 |
def initialize_cuda():
|
|
|
79 |
print(f"CUDA is available. Using device: {cuda.get_device_name(0)} with CUDA version: {version.cuda}")
|
80 |
result = "cuda"
|
81 |
else:
|
82 |
+
#device = cuda.device("cpu")
|
83 |
print("CUDA is not available. Using CPU.")
|
84 |
result = "cpu"
|
85 |
return result
|