Update prerendered Image, update LUTs to filters, improve the ability of filters to work with other image types
Browse files- utils/constants.py +57 -48
utils/constants.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import os
|
2 |
#Set the environment variables
|
3 |
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
|
4 |
-
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:
|
5 |
IS_SHARED_SPACE = "Surn/HexaGridCreator" in os.environ.get('SPACE_ID', '')
|
6 |
|
7 |
# Set the temporary folder location
|
@@ -15,28 +15,26 @@ os.environ['XFORMERS_FORCE_DISABLE_TRITON']= '1'
|
|
15 |
os.environ["HF_TOKEN"] = ""
|
16 |
HF_API_TOKEN = os.getenv("HF_TOKEN")
|
17 |
default_lut_example_img = "./LUT/daisy.jpg"
|
18 |
-
os.environ["HF_TOKEN"] = """
|
19 |
-
HF_API_TOKEN = os.getenv("HF_TOKEN")
|
20 |
|
21 |
PROMPTS = {
|
22 |
-
"
|
23 |
-
"
|
24 |
"Map3": "top-down, bird's-eye view of A mystic forest-themed map viewed from directly above, showcasing detailed terrain features such as lakes, dense forests, magical flora, and hexagonal grids. The map is designed for tabletop gaming, emphasizing clarity and strategic elements, eight_color (tabletop_map built from small hexagon pieces) as alien_forest_world_map, with light_blue_is_lakes and green_is_forests and purple_is_alien_flora and [white_is_snow at the top and bottom of map] as (four_color background: light_blue, green, purple, brown), horizontal_gradient is (green to purple to light_blue to blue) and vertical_gradient is (white to blue to (green, purple and brown) to blue to white), (middle is dark, no_reflections, no_shadows), ((partial hexes on edges and sides are black))",
|
25 |
"Map4": "A top-down, bird's-eye view of a medieval battlefield map for tabletop games, eight_color (tabletop_map built from small hexagon pieces) as mystic_forest_world_map, with teal_is_lakes and dark_green_is_forest and violet_is_magic_fauna and [white_is_snow at the top and bottom of map] as (four_color background: teal, dark_green, violet, brown), horizontal_gradient is (brown to violet to teal to blue) and vertical_gradient is (white to blue to (dark_green, violet and brown) to blue to white), (middle is enchanted, no_reflections, no_shadows), ((partial hexes on edges and sides are black)), viewed from above, flat and illustrative, not a map of the Earth",
|
26 |
"Alien Landscape": "top-down view of a barren alien world map made from hexagon pieces. Features light blue rivers, brown mountains, red volcanoes, and white snow at the top and bottom. Background colors: light blue, green, tan, brown. Partial hexes on edges are black.",
|
27 |
-
"Alien World": "top-down view of an
|
28 |
"Mystic Forest": "top-down view of a mystic forest map with lakes, dense forests, magical flora, and hexagonal grids. Designed for clarity in tabletop gaming. Background colors: light blue, green, purple, brown. Partial hexes on edges are black.",
|
29 |
"Medieval Battlefield": "top-down view of a medieval battlefield map featuring lakes, forests, and magic fauna. Emphasizes clarity and strategy for tabletop games. Background colors: teal, dark green, violet, brown. Partial edge hexes are black. Viewed from above.",
|
30 |
"Prompt": None # Indicates that the prompt should be taken from prompt_textbox
|
31 |
}
|
32 |
|
33 |
NEGATIVE_PROMPTS = {
|
34 |
-
"
|
35 |
-
"
|
36 |
"Map3": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
37 |
"Map4": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
38 |
"Alien Landscape": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
39 |
-
"Alien World": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
40 |
"Mystic Forest": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
41 |
"Medieval Battlefield": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
42 |
"Prompt": None # Indicates that the negative prompt should be taken from negative_prompt_textbox
|
@@ -49,63 +47,71 @@ ASSETS_DIR = "images/prerendered"
|
|
49 |
PRE_RENDERED_MAPS = [
|
50 |
"alien_orb_land_1.png",
|
51 |
"alien_prarie_1.png",
|
52 |
-
"alien_world_1.
|
53 |
-
"alien_world_2.
|
54 |
-
"alien_world_3.
|
55 |
-
"alien_world_4.
|
56 |
-
"alien_world_5.
|
57 |
"canyon_water_1.png",
|
|
|
|
|
|
|
|
|
|
|
58 |
"dark_dirt_elevations_1.png",
|
59 |
"elevated_peninsula_1.png",
|
60 |
"Firefly_alien_canyons_1.png",
|
61 |
-
"Firefly_alien_canyons_2.jpg",
|
62 |
"Firefly_alien_canyons_2.png",
|
63 |
-
"
|
64 |
-
"
|
65 |
-
"
|
|
|
66 |
"Firefly_hpg_terrain_1.png",
|
67 |
"Firefly_hpg_terrain_2.png",
|
68 |
-
"Firefly_river_dry_1.
|
69 |
-
"Firefly_river_running_1.
|
70 |
-
"Firefly_topographical_alien_desert_1.
|
71 |
-
"Firefly_topographical_canyon_1.
|
72 |
-
"Firefly_topographical_height_map_1.
|
73 |
-
"Firefly_topographical_height_map_2.
|
74 |
-
"Firefly_topographical_height_map_3.
|
75 |
-
"Firefly_topographical_height_map_5.
|
76 |
-
"Firefly_topographical_height_map_6.
|
77 |
-
"Firefly_topographical_marble_1.
|
78 |
-
"Firefly_topographical_moon_1.
|
79 |
-
"green_farming alien_world_1.
|
80 |
-
"green_farming alien_world_2.
|
81 |
-
"grey_barren_alien_world_1.
|
82 |
-
"grey_barren_alien_world_2.
|
83 |
-
"grey_barren_alien_world_3.
|
84 |
-
"grey_barren_alien_world_4.
|
85 |
-
"grey_barren_alien_world_5.
|
86 |
-
"grey_barren_alien_world_6.
|
87 |
-
"grey_barren_alien_world_7.
|
88 |
-
"grey_waterless_alien_world_map.
|
89 |
-
"grid_1.
|
90 |
"Hex_gen_map.PNG",
|
91 |
"hex_grass_dirty.png",
|
92 |
-
"hex_military_industrial alien_world_map.
|
93 |
"hex_mixed_elevations_battlefield_1.png",
|
94 |
"hex_mixed_elevations_battlefield_2.png",
|
95 |
"mixed_elevations_battlefield_3.png",
|
96 |
"n6W9Hc.png",
|
97 |
"oasis_mixed_elevations_1.png",
|
98 |
"pic526383.png",
|
99 |
-
"red_volcanic_alien_1.
|
100 |
-
"red_volcanic_alien_2.
|
101 |
-
"red_volcanic_alien_3.
|
102 |
-
"red_volcanic_alien_4.
|
103 |
"roadway_1.png",
|
104 |
"snowy_rolling_hills_1.png",
|
105 |
-
"volcanic alien_world_map.
|
106 |
-
"war-torn_post-apocalyptic_alien_world_map.
|
107 |
]
|
108 |
|
|
|
|
|
|
|
109 |
|
110 |
# Generate a dictionary with cleaned-up names as keys and file paths as values
|
111 |
PRE_RENDERED_MAPS_JSON = {
|
@@ -203,7 +209,7 @@ LORA_DETAILS = {
|
|
203 |
"trigger_words": "disney style,",
|
204 |
},
|
205 |
{
|
206 |
-
"notes": "You should use ',disney style' as trigger words at the end. @
|
207 |
},
|
208 |
{
|
209 |
"parameters" :{
|
@@ -281,5 +287,8 @@ LORA_DETAILS = {
|
|
281 |
}
|
282 |
]
|
283 |
}
|
|
|
|
|
|
|
284 |
|
285 |
temp_files = []
|
|
|
1 |
import os
|
2 |
#Set the environment variables
|
3 |
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
|
4 |
+
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:256,expandable_segments:True"
|
5 |
IS_SHARED_SPACE = "Surn/HexaGridCreator" in os.environ.get('SPACE_ID', '')
|
6 |
|
7 |
# Set the temporary folder location
|
|
|
15 |
os.environ["HF_TOKEN"] = ""
|
16 |
HF_API_TOKEN = os.getenv("HF_TOKEN")
|
17 |
default_lut_example_img = "./LUT/daisy.jpg"
|
|
|
|
|
18 |
|
19 |
PROMPTS = {
|
20 |
+
"BorderBlack": "eight_color (tabletop_map built from small hexagon pieces) as ((empty black on all sides), barren alien_world_map), with light_blue_is_rivers and brown_is_mountains and red_is_volcano and [white_is_snow at the top and bottom of map] as (four_color background: light_blue, green, tan, brown), horizontal_gradient is (brown to tan to green to light_blue to blue) and vertical_gradient is (white to blue to (green, tan and red) to blue to white), (middle is dark, no_reflections, no_shadows), ((partial hexes on edges and sides are black))",
|
21 |
+
"Earth": "eight_color (tabletop_map built from small hexagon pieces) as world_map, with light_blue_is_rivers and brown_is_mountains and red_is_volcano and [white_is_snow at the top and bottom of map] as (four_color background: light_blue, green, tan, brown), horizontal_gradient is (brown to tan to green to light_blue to blue) and vertical_gradient is (white to blue to (green, tan and red) to blue to white), (middle is dark, no_reflections, no_shadows), ((partial hexes on edges and sides are black)), overhead_view, from_above",
|
22 |
"Map3": "top-down, bird's-eye view of A mystic forest-themed map viewed from directly above, showcasing detailed terrain features such as lakes, dense forests, magical flora, and hexagonal grids. The map is designed for tabletop gaming, emphasizing clarity and strategic elements, eight_color (tabletop_map built from small hexagon pieces) as alien_forest_world_map, with light_blue_is_lakes and green_is_forests and purple_is_alien_flora and [white_is_snow at the top and bottom of map] as (four_color background: light_blue, green, purple, brown), horizontal_gradient is (green to purple to light_blue to blue) and vertical_gradient is (white to blue to (green, purple and brown) to blue to white), (middle is dark, no_reflections, no_shadows), ((partial hexes on edges and sides are black))",
|
23 |
"Map4": "A top-down, bird's-eye view of a medieval battlefield map for tabletop games, eight_color (tabletop_map built from small hexagon pieces) as mystic_forest_world_map, with teal_is_lakes and dark_green_is_forest and violet_is_magic_fauna and [white_is_snow at the top and bottom of map] as (four_color background: teal, dark_green, violet, brown), horizontal_gradient is (brown to violet to teal to blue) and vertical_gradient is (white to blue to (dark_green, violet and brown) to blue to white), (middle is enchanted, no_reflections, no_shadows), ((partial hexes on edges and sides are black)), viewed from above, flat and illustrative, not a map of the Earth",
|
24 |
"Alien Landscape": "top-down view of a barren alien world map made from hexagon pieces. Features light blue rivers, brown mountains, red volcanoes, and white snow at the top and bottom. Background colors: light blue, green, tan, brown. Partial hexes on edges are black.",
|
25 |
+
"Alien World": "top-down view of an alien_world map built from hexagon pieces. Includes rivers, mountains, volcanoes, and snowy areas. Uses a four-color background: light blue, green, tan, brown. Partial edge hexes are black. Overhead view.",
|
26 |
"Mystic Forest": "top-down view of a mystic forest map with lakes, dense forests, magical flora, and hexagonal grids. Designed for clarity in tabletop gaming. Background colors: light blue, green, purple, brown. Partial hexes on edges are black.",
|
27 |
"Medieval Battlefield": "top-down view of a medieval battlefield map featuring lakes, forests, and magic fauna. Emphasizes clarity and strategy for tabletop games. Background colors: teal, dark green, violet, brown. Partial edge hexes are black. Viewed from above.",
|
28 |
"Prompt": None # Indicates that the prompt should be taken from prompt_textbox
|
29 |
}
|
30 |
|
31 |
NEGATIVE_PROMPTS = {
|
32 |
+
"BorderBlack": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
33 |
+
"Earth": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, missing realistic map of the Earth, isometric",
|
34 |
"Map3": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
35 |
"Map4": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
36 |
"Alien Landscape": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
37 |
+
"Alien World": "Earth, humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
38 |
"Mystic Forest": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
39 |
"Medieval Battlefield": "humans, modern_buildings, vehicles, text, logos, reflections, shadows, realistic map of the Earth, isometric",
|
40 |
"Prompt": None # Indicates that the negative prompt should be taken from negative_prompt_textbox
|
|
|
47 |
PRE_RENDERED_MAPS = [
|
48 |
"alien_orb_land_1.png",
|
49 |
"alien_prarie_1.png",
|
50 |
+
"alien_world_1.png",
|
51 |
+
"alien_world_2.png",
|
52 |
+
"alien_world_3.png",
|
53 |
+
"alien_world_4.png",
|
54 |
+
"alien_world_5.png",
|
55 |
"canyon_water_1.png",
|
56 |
+
"CONQ_Caustic_Valley.png",
|
57 |
+
"CONQ_Frozen_City.png",
|
58 |
+
"CONQ_Hellebore_Springs.png",
|
59 |
+
"CONQ_Terra_Therma.png",
|
60 |
+
"CONQ_Viridian_Bog.png",
|
61 |
"dark_dirt_elevations_1.png",
|
62 |
"elevated_peninsula_1.png",
|
63 |
"Firefly_alien_canyons_1.png",
|
|
|
64 |
"Firefly_alien_canyons_2.png",
|
65 |
+
"Firefly_alien_canyons_2.png",
|
66 |
+
"Firefly_alien_dry_canyons_1.png",
|
67 |
+
"Firefly_alien_dry_canyons_2.png",
|
68 |
+
"Firefly_alien_map_1.png",
|
69 |
"Firefly_hpg_terrain_1.png",
|
70 |
"Firefly_hpg_terrain_2.png",
|
71 |
+
"Firefly_river_dry_1.png",
|
72 |
+
"Firefly_river_running_1.png",
|
73 |
+
"Firefly_topographical_alien_desert_1.png",
|
74 |
+
"Firefly_topographical_canyon_1.png",
|
75 |
+
"Firefly_topographical_height_map_1.png",
|
76 |
+
"Firefly_topographical_height_map_2.png",
|
77 |
+
"Firefly_topographical_height_map_3.png",
|
78 |
+
"Firefly_topographical_height_map_5.png",
|
79 |
+
"Firefly_topographical_height_map_6.png",
|
80 |
+
"Firefly_topographical_marble_1.png",
|
81 |
+
"Firefly_topographical_moon_1.png",
|
82 |
+
"green_farming alien_world_1.png",
|
83 |
+
"green_farming alien_world_2.png",
|
84 |
+
"grey_barren_alien_world_1.png",
|
85 |
+
"grey_barren_alien_world_2.png",
|
86 |
+
"grey_barren_alien_world_3.png",
|
87 |
+
"grey_barren_alien_world_4.png",
|
88 |
+
"grey_barren_alien_world_5.png",
|
89 |
+
"grey_barren_alien_world_6.png",
|
90 |
+
"grey_barren_alien_world_7.png",
|
91 |
+
"grey_waterless_alien_world_map.png",
|
92 |
+
"grid_1.png",
|
93 |
"Hex_gen_map.PNG",
|
94 |
"hex_grass_dirty.png",
|
95 |
+
"hex_military_industrial alien_world_map.png",
|
96 |
"hex_mixed_elevations_battlefield_1.png",
|
97 |
"hex_mixed_elevations_battlefield_2.png",
|
98 |
"mixed_elevations_battlefield_3.png",
|
99 |
"n6W9Hc.png",
|
100 |
"oasis_mixed_elevations_1.png",
|
101 |
"pic526383.png",
|
102 |
+
"red_volcanic_alien_1.png",
|
103 |
+
"red_volcanic_alien_2.png",
|
104 |
+
"red_volcanic_alien_3.png",
|
105 |
+
"red_volcanic_alien_4.png",
|
106 |
"roadway_1.png",
|
107 |
"snowy_rolling_hills_1.png",
|
108 |
+
"volcanic alien_world_map.png",
|
109 |
+
"war-torn_post-apocalyptic_alien_world_map.png"
|
110 |
]
|
111 |
|
112 |
+
# Create full paths for pre-rendered maps
|
113 |
+
pre_rendered_maps_paths = [os.path.join(ASSETS_DIR, map_file).replace("\\", "/") for map_file in PRE_RENDERED_MAPS]
|
114 |
+
pre_rendered_maps_paths_api_file = [f"./gradio_api/file={map_path}" for map_path in pre_rendered_maps_paths]
|
115 |
|
116 |
# Generate a dictionary with cleaned-up names as keys and file paths as values
|
117 |
PRE_RENDERED_MAPS_JSON = {
|
|
|
209 |
"trigger_words": "disney style,",
|
210 |
},
|
211 |
{
|
212 |
+
"notes": "You should use ',disney style' as trigger words at the end. @12min "
|
213 |
},
|
214 |
{
|
215 |
"parameters" :{
|
|
|
287 |
}
|
288 |
]
|
289 |
}
|
290 |
+
# Read the contents of the LUT folder, output to a list
|
291 |
+
lut_folder = "./LUT"
|
292 |
+
lut_files = [os.path.join(lut_folder, f).replace("\\", "/") for f in os.listdir(lut_folder) if f.endswith(".cube")]
|
293 |
|
294 |
temp_files = []
|