Spaces:
Running
Running
Andre
commited on
Commit
·
4011dd8
1
Parent(s):
8322301
Update LS ID gen
Browse files- adventurers_data.json +19 -19
- adventurers_data2.json +11 -155
- app.py +2 -2
- src/__pycache__/img_gen.cpython-311.pyc +0 -0
- src/img_gen.py +20 -7
- src/temp.py +16 -0
adventurers_data.json
CHANGED
@@ -2,32 +2,32 @@
|
|
2 |
"data": {
|
3 |
"adventurers": [
|
4 |
{
|
5 |
-
"owner": "
|
6 |
-
"id":
|
7 |
-
"name": "
|
8 |
-
"strength":
|
9 |
-
"vitality":
|
10 |
-
"dexterity":
|
11 |
"intelligence": 1,
|
12 |
-
"wisdom":
|
13 |
-
"charisma":
|
14 |
-
"level":
|
15 |
-
"xp":
|
16 |
"health": 0,
|
17 |
"beastHealth": 0,
|
18 |
-
"head":
|
19 |
-
"hand":
|
20 |
-
"chest":
|
21 |
-
"waist":
|
22 |
-
"foot":
|
23 |
-
"weapon": "
|
24 |
-
"gold":
|
25 |
"neck": null,
|
26 |
"ring": null,
|
27 |
-
"luck":
|
28 |
"battleActionCount": 0,
|
29 |
"customRenderer": null,
|
30 |
-
"statUpgrades":
|
31 |
}
|
32 |
]
|
33 |
}
|
|
|
2 |
"data": {
|
3 |
"adventurers": [
|
4 |
{
|
5 |
+
"owner": "0x5182d69e155054d4852c775f3da3df704fd12fd77ebcc97b0a4ec3d619f60e6",
|
6 |
+
"id": 463,
|
7 |
+
"name": "The Syndicate #140",
|
8 |
+
"strength": 0,
|
9 |
+
"vitality": 2,
|
10 |
+
"dexterity": 0,
|
11 |
"intelligence": 1,
|
12 |
+
"wisdom": 4,
|
13 |
+
"charisma": 2,
|
14 |
+
"level": 2,
|
15 |
+
"xp": 4,
|
16 |
"health": 0,
|
17 |
"beastHealth": 0,
|
18 |
+
"head": null,
|
19 |
+
"hand": null,
|
20 |
+
"chest": null,
|
21 |
+
"waist": null,
|
22 |
+
"foot": null,
|
23 |
+
"weapon": "Wand",
|
24 |
+
"gold": 25,
|
25 |
"neck": null,
|
26 |
"ring": null,
|
27 |
+
"luck": 0,
|
28 |
"battleActionCount": 0,
|
29 |
"customRenderer": null,
|
30 |
+
"statUpgrades": 1
|
31 |
}
|
32 |
]
|
33 |
}
|
adventurers_data2.json
CHANGED
@@ -2,117 +2,27 @@
|
|
2 |
"data": {
|
3 |
"battles": [
|
4 |
{
|
5 |
-
"adventurerId":
|
6 |
-
"adventurerHealth":
|
7 |
-
"beast": "
|
8 |
-
"beastHealth":
|
9 |
-
"beastLevel":
|
10 |
-
"seed": "
|
11 |
-
"attacker": "Adventurer",
|
12 |
-
"fled": false,
|
13 |
-
"damageDealt": 4,
|
14 |
-
"criticalHit": false,
|
15 |
-
"damageTaken": 0,
|
16 |
-
"damageLocation": null,
|
17 |
-
"xpEarnedAdventurer": 0,
|
18 |
-
"xpEarnedItems": 0,
|
19 |
-
"goldEarned": 0,
|
20 |
-
"discoveryTime": "2024-09-11T21:56:12.363Z"
|
21 |
-
},
|
22 |
-
{
|
23 |
-
"adventurerId": 450,
|
24 |
-
"adventurerHealth": 49,
|
25 |
-
"beast": "Wyvern",
|
26 |
-
"beastHealth": 10,
|
27 |
-
"beastLevel": 3,
|
28 |
-
"seed": "0x3f6f4350",
|
29 |
-
"attacker": "Beast",
|
30 |
-
"fled": false,
|
31 |
-
"damageDealt": 0,
|
32 |
-
"criticalHit": false,
|
33 |
-
"damageTaken": 13,
|
34 |
-
"damageLocation": "Foot",
|
35 |
-
"xpEarnedAdventurer": 0,
|
36 |
-
"xpEarnedItems": 0,
|
37 |
-
"goldEarned": 0,
|
38 |
-
"discoveryTime": "2024-09-11T21:56:12.363Z"
|
39 |
-
},
|
40 |
-
{
|
41 |
-
"adventurerId": 450,
|
42 |
-
"adventurerHealth": 75,
|
43 |
-
"beast": "Wyvern",
|
44 |
-
"beastHealth": 18,
|
45 |
-
"beastLevel": 3,
|
46 |
-
"seed": "0x3f6f4350",
|
47 |
-
"attacker": "Adventurer",
|
48 |
-
"fled": false,
|
49 |
-
"damageDealt": 4,
|
50 |
-
"criticalHit": false,
|
51 |
-
"damageTaken": 0,
|
52 |
-
"damageLocation": null,
|
53 |
-
"xpEarnedAdventurer": 0,
|
54 |
-
"xpEarnedItems": 0,
|
55 |
-
"goldEarned": 0,
|
56 |
-
"discoveryTime": "2024-09-11T21:56:12.361Z"
|
57 |
-
},
|
58 |
-
{
|
59 |
-
"adventurerId": 450,
|
60 |
-
"adventurerHealth": 62,
|
61 |
-
"beast": "Wyvern",
|
62 |
-
"beastHealth": 14,
|
63 |
-
"beastLevel": 3,
|
64 |
-
"seed": "0x3f6f4350",
|
65 |
-
"attacker": "Beast",
|
66 |
-
"fled": false,
|
67 |
-
"damageDealt": 0,
|
68 |
-
"criticalHit": false,
|
69 |
-
"damageTaken": 13,
|
70 |
-
"damageLocation": "Waist",
|
71 |
-
"xpEarnedAdventurer": 0,
|
72 |
-
"xpEarnedItems": 0,
|
73 |
-
"goldEarned": 0,
|
74 |
-
"discoveryTime": "2024-09-11T21:56:12.363Z"
|
75 |
-
},
|
76 |
-
{
|
77 |
-
"adventurerId": 450,
|
78 |
-
"adventurerHealth": 75,
|
79 |
-
"beast": "Wyvern",
|
80 |
-
"beastHealth": 18,
|
81 |
-
"beastLevel": 3,
|
82 |
-
"seed": "0x3f6f4350",
|
83 |
"attacker": "Beast",
|
84 |
"fled": false,
|
85 |
"damageDealt": 0,
|
86 |
"criticalHit": false,
|
87 |
-
"damageTaken":
|
88 |
"damageLocation": "Chest",
|
89 |
"xpEarnedAdventurer": 0,
|
90 |
"xpEarnedItems": 0,
|
91 |
"goldEarned": 0,
|
92 |
-
"discoveryTime": "2024-09-
|
93 |
},
|
94 |
{
|
95 |
-
"adventurerId":
|
96 |
-
"adventurerHealth": 79,
|
97 |
-
"beast": "Wyvern",
|
98 |
-
"beastHealth": 22,
|
99 |
-
"beastLevel": 3,
|
100 |
-
"seed": "0x3f6f4350",
|
101 |
-
"attacker": "Beast",
|
102 |
-
"fled": false,
|
103 |
-
"damageDealt": 0,
|
104 |
-
"criticalHit": false,
|
105 |
-
"damageTaken": 13,
|
106 |
-
"damageLocation": "Head",
|
107 |
-
"xpEarnedAdventurer": 0,
|
108 |
-
"xpEarnedItems": 0,
|
109 |
-
"goldEarned": 0,
|
110 |
-
"discoveryTime": "2024-09-11T21:56:12.361Z"
|
111 |
-
},
|
112 |
-
{
|
113 |
-
"adventurerId": 450,
|
114 |
"adventurerHealth": 90,
|
115 |
-
"beast": "
|
116 |
"beastHealth": 0,
|
117 |
"beastLevel": 1,
|
118 |
"seed": "0x5a60e008",
|
@@ -125,61 +35,7 @@
|
|
125 |
"xpEarnedAdventurer": 4,
|
126 |
"xpEarnedItems": 8,
|
127 |
"goldEarned": 0,
|
128 |
-
"discoveryTime": "2024-09-
|
129 |
-
},
|
130 |
-
{
|
131 |
-
"adventurerId": 450,
|
132 |
-
"adventurerHealth": 90,
|
133 |
-
"beast": "Fairy",
|
134 |
-
"beastHealth": 3,
|
135 |
-
"beastLevel": 1,
|
136 |
-
"seed": "0x1c2",
|
137 |
-
"attacker": "Beast",
|
138 |
-
"fled": false,
|
139 |
-
"damageDealt": 0,
|
140 |
-
"criticalHit": false,
|
141 |
-
"damageTaken": 10,
|
142 |
-
"damageLocation": "Chest",
|
143 |
-
"xpEarnedAdventurer": 0,
|
144 |
-
"xpEarnedItems": 0,
|
145 |
-
"goldEarned": 0,
|
146 |
-
"discoveryTime": "2024-09-10T18:35:14.760Z"
|
147 |
-
},
|
148 |
-
{
|
149 |
-
"adventurerId": 450,
|
150 |
-
"adventurerHealth": 79,
|
151 |
-
"beast": "Wyvern",
|
152 |
-
"beastHealth": 22,
|
153 |
-
"beastLevel": 3,
|
154 |
-
"seed": "0x3f6f4350",
|
155 |
-
"attacker": "Adventurer",
|
156 |
-
"fled": false,
|
157 |
-
"damageDealt": 4,
|
158 |
-
"criticalHit": false,
|
159 |
-
"damageTaken": 0,
|
160 |
-
"damageLocation": null,
|
161 |
-
"xpEarnedAdventurer": 0,
|
162 |
-
"xpEarnedItems": 0,
|
163 |
-
"goldEarned": 0,
|
164 |
-
"discoveryTime": "2024-09-11T21:56:12.361Z"
|
165 |
-
},
|
166 |
-
{
|
167 |
-
"adventurerId": 450,
|
168 |
-
"adventurerHealth": 62,
|
169 |
-
"beast": "Wyvern",
|
170 |
-
"beastHealth": 14,
|
171 |
-
"beastLevel": 3,
|
172 |
-
"seed": "0x3f6f4350",
|
173 |
-
"attacker": "Adventurer",
|
174 |
-
"fled": false,
|
175 |
-
"damageDealt": 4,
|
176 |
-
"criticalHit": false,
|
177 |
-
"damageTaken": 0,
|
178 |
-
"damageLocation": null,
|
179 |
-
"xpEarnedAdventurer": 0,
|
180 |
-
"xpEarnedItems": 0,
|
181 |
-
"goldEarned": 0,
|
182 |
-
"discoveryTime": "2024-09-11T21:56:12.362Z"
|
183 |
}
|
184 |
]
|
185 |
}
|
|
|
2 |
"data": {
|
3 |
"battles": [
|
4 |
{
|
5 |
+
"adventurerId": 463,
|
6 |
+
"adventurerHealth": 90,
|
7 |
+
"beast": "Orc",
|
8 |
+
"beastHealth": 3,
|
9 |
+
"beastLevel": 1,
|
10 |
+
"seed": "0x1cf",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
"attacker": "Beast",
|
12 |
"fled": false,
|
13 |
"damageDealt": 0,
|
14 |
"criticalHit": false,
|
15 |
+
"damageTaken": 10,
|
16 |
"damageLocation": "Chest",
|
17 |
"xpEarnedAdventurer": 0,
|
18 |
"xpEarnedItems": 0,
|
19 |
"goldEarned": 0,
|
20 |
+
"discoveryTime": "2024-09-10T18:35:14.764Z"
|
21 |
},
|
22 |
{
|
23 |
+
"adventurerId": 463,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
"adventurerHealth": 90,
|
25 |
+
"beast": "Orc",
|
26 |
"beastHealth": 0,
|
27 |
"beastLevel": 1,
|
28 |
"seed": "0x5a60e008",
|
|
|
35 |
"xpEarnedAdventurer": 4,
|
36 |
"xpEarnedItems": 8,
|
37 |
"goldEarned": 0,
|
38 |
+
"discoveryTime": "2024-09-10T18:41:37.103Z"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
]
|
41 |
}
|
app.py
CHANGED
@@ -21,7 +21,7 @@ def gradio_interface():
|
|
21 |
gr.Markdown("# ========== Loot Survivor - AI Image Generator ==========")
|
22 |
with gr.Row():
|
23 |
# Set default values for dropdowns
|
24 |
-
prompt_dropdown = gr.Dropdown(choices=[p["alias"] for p in prompts], label="Select Beast", value=prompts[0]["alias"])
|
25 |
adventurer_id = gr.Number(label="Adventurer ID:")
|
26 |
character_dropdown = gr.Dropdown(choices=["Portait", "Last battle", "Loot bag"], label="Select Scene", value="Portait")
|
27 |
model_dropdown = gr.Dropdown(choices=[m["alias"] for m in models], label="Select Model", value=models[0]["alias"])
|
@@ -39,7 +39,7 @@ def gradio_interface():
|
|
39 |
generate_button.click(
|
40 |
generate_image,
|
41 |
inputs=[adventurer_id,
|
42 |
-
prompt_dropdown,
|
43 |
custom_prompt_input,
|
44 |
character_dropdown,
|
45 |
model_dropdown
|
|
|
21 |
gr.Markdown("# ========== Loot Survivor - AI Image Generator ==========")
|
22 |
with gr.Row():
|
23 |
# Set default values for dropdowns
|
24 |
+
#prompt_dropdown = gr.Dropdown(choices=[p["alias"] for p in prompts], label="Select Beast", value=prompts[0]["alias"])
|
25 |
adventurer_id = gr.Number(label="Adventurer ID:")
|
26 |
character_dropdown = gr.Dropdown(choices=["Portait", "Last battle", "Loot bag"], label="Select Scene", value="Portait")
|
27 |
model_dropdown = gr.Dropdown(choices=[m["alias"] for m in models], label="Select Model", value=models[0]["alias"])
|
|
|
39 |
generate_button.click(
|
40 |
generate_image,
|
41 |
inputs=[adventurer_id,
|
42 |
+
#prompt_dropdown,
|
43 |
custom_prompt_input,
|
44 |
character_dropdown,
|
45 |
model_dropdown
|
src/__pycache__/img_gen.cpython-311.pyc
CHANGED
Binary files a/src/__pycache__/img_gen.cpython-311.pyc and b/src/__pycache__/img_gen.cpython-311.pyc differ
|
|
src/img_gen.py
CHANGED
@@ -10,7 +10,7 @@ from metadata.metadata import fetch_metadata
|
|
10 |
|
11 |
def generate_image(
|
12 |
adventurer_id,
|
13 |
-
prompt_alias,
|
14 |
custom_prompt,
|
15 |
characer_dropdown,
|
16 |
model_alias,
|
@@ -23,15 +23,25 @@ def generate_image(
|
|
23 |
adventurer = fetch_metadata(adventurer_id)
|
24 |
print(f"ANDRE {adventurer['name']}")
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# Set the custom prompt variables
|
27 |
if characer_dropdown == "Portait":
|
28 |
-
prompt = f"A portait of a medieval, fantasy adventurer,
|
29 |
|
30 |
if characer_dropdown == "Last battle":
|
31 |
-
prompt = f"A battle between a medieval fantasy adventurer, and a
|
32 |
|
33 |
elif characer_dropdown == "Loot bag":
|
34 |
-
prompt = f"A loot bag from a medieval fantasy adventurer and his equipments. On the floor also a {
|
35 |
else:
|
36 |
pass
|
37 |
|
@@ -98,11 +108,14 @@ def generate_image(
|
|
98 |
print("-----SAVING-----", image)
|
99 |
path = "images"
|
100 |
|
101 |
-
message = f"Image generated successfully! Call the banners! \nID: {
|
102 |
-
file_name_extension = f"ID: {
|
103 |
|
104 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
105 |
-
output_filename = f"{path}/{timestamp}_{seed}_{model_alias.replace(' ', '_').lower()}_{
|
|
|
|
|
|
|
106 |
try:
|
107 |
image.save(output_filename)
|
108 |
except Exception as e:
|
|
|
10 |
|
11 |
def generate_image(
|
12 |
adventurer_id,
|
13 |
+
#prompt_alias,
|
14 |
custom_prompt,
|
15 |
characer_dropdown,
|
16 |
model_alias,
|
|
|
23 |
adventurer = fetch_metadata(adventurer_id)
|
24 |
print(f"ANDRE {adventurer['name']}")
|
25 |
|
26 |
+
id = adventurer['id']
|
27 |
+
name = adventurer['name']
|
28 |
+
weapon_equipment = adventurer['weapon']
|
29 |
+
head_equipment = adventurer['head']
|
30 |
+
hand_equipment = adventurer['hand']
|
31 |
+
chest_equipment = adventurer['chest']
|
32 |
+
waist_equipment = adventurer['waist']
|
33 |
+
foot_equipment = adventurer['foot']
|
34 |
+
beast_last_battle = adventurer['beast']
|
35 |
+
|
36 |
# Set the custom prompt variables
|
37 |
if characer_dropdown == "Portait":
|
38 |
+
prompt = f"A portait of a medieval, fantasy adventurer, holding a {weapon_equipment} (depending on his weapon, make the characer dressed as a warrior, or as a hunter or as a wizard). He is also equiped in the head with a {head_equipment}, the hands with {hand_equipment}, the chest with a {chest_equipment}, and the waist with a {waist_equipment}. Please be sure to use only medieval items that were possble to be made in that period. Make the adventurer unshaved and dirty, he have been figthing for days down into the dungeons. Unreal Engine render style, photorealistic, atmospheric light, realistic fantasy style."
|
39 |
|
40 |
if characer_dropdown == "Last battle":
|
41 |
+
prompt = f"A battle between a medieval fantasy adventurer, and a massive {beast_last_battle} monster. The adventurer is holding a weapon: a {weapon_equipment}. He is also equiped in the head with {head_equipment}, the hands with {hand_equipment}, the chest with {chest_equipment}, the waist with {waist_equipment}, the fet with {foot_equipment}. Use only medieval items that were possble to be made in that period. Add details for the monster as well. The scene location is the natural ambient of the {beast_last_battle}. Unreal Engine render style, photorealistic, realistic fantasy style."
|
42 |
|
43 |
elif characer_dropdown == "Loot bag":
|
44 |
+
prompt = f"A loot bag from a medieval fantasy adventurer and his equipments. On the floor also a {weapon_equipment} a {head_equipment}, a {hand_equipment}, a {chest_equipment}, a {waist_equipment}, and a {foot_equipment}. Please sure to use only medieval items that were possble to be made in that period. Inside the bag also gold coins. Atmospheric light, cavern, dungeon context. Unreal Engine render style, photorealistic, realistic fantasy style."
|
45 |
else:
|
46 |
pass
|
47 |
|
|
|
108 |
print("-----SAVING-----", image)
|
109 |
path = "images"
|
110 |
|
111 |
+
message = f"Image generated successfully! Call the banners! \n\n=====ADVENTURER GENERATED===== \nID: {id}\nNAME: {name}\nWEAPON: {weapon_equipment}\nHEAD: {head_equipment}\nHAND: {hand_equipment}\nCHEST: {chest_equipment}\nWAIST: {waist_equipment}\nBEAST: {beast_last_battle}"
|
112 |
+
file_name_extension = f"ID: {id}\nNAME: {name}\nWEAPON: {weapon_equipment}\nHEAD: {head_equipment}\nHAND: {hand_equipment}\nCHEST: {chest_equipment}\nWAIST: {waist_equipment}\n LAST BATTLE BEAST: {beast_last_battle}"
|
113 |
|
114 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
115 |
+
output_filename = f"{path}/{timestamp}_{seed}_{model_alias.replace(' ', '_').lower()}_{characer_dropdown.replace(' ', '_').lower()}_{file_name_extension.replace(' ', '_').lower()}.png"
|
116 |
+
|
117 |
+
# output_filename = f"{path}/{timestamp}_{seed}_{model_alias.replace(' ', '_').lower()}_{prompt_alias.replace(' ', '_').lower()}_{characer_dropdown.replace(' ', '_').lower()}_{file_name_extension.replace(' ', '_').lower()}.png"
|
118 |
+
|
119 |
try:
|
120 |
image.save(output_filename)
|
121 |
except Exception as e:
|
src/temp.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Dungeon context, stones, fire and low light.
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
if characer_dropdown == "Portait":
|
8 |
+
prompt = f"A portait of a medieval, fantasy adventurer, holding a {weapon_equipment} (depending on his weapon, make the characer dressed as a warrior, or as a hunter or as a wizard). He is also equiped in the head with a {head_equipment}, the hands with {hand_equipment}, the chest with a {chest_equipment}, and the waist with a {waist_equipment}. Please be sure to use only medieval items that were possble to be made in that period. Make the adventurer unshaved and dirty, he have been figthing for days down into the dungeons. Unreal Engine render style, photorealistic, atmospheric light, realistic fantasy style."
|
9 |
+
|
10 |
+
if characer_dropdown == "Last battle":
|
11 |
+
prompt = f"A battle between a medieval fantasy adventurer, and a massive {beast_last_battle} monster. The adventurer is combating with a weapon: a {weapon_equipment} (depending on his equipment, make the characer dressed as a warrior, or as a hunter or as a wizard). He is also equiped in the head with {head_equipment}, the hands with {hand_equipment}, the chest with {chest_equipment}, the waist with {waist_equipment}, the fet with {foot_equipment}. Please sure to use only medieval items that were possble to be made in that period. Add details for the monster as well. The scene location is the natural ambient of the {beast_last_battle}. Unreal Engine render style, photorealistic, dark atmospheric light, realistic fantasy style."
|
12 |
+
|
13 |
+
elif characer_dropdown == "Loot bag":
|
14 |
+
prompt = f"A loot bag from a medieval fantasy adventurer and his equipments. On the floor also a {weapon_equipment} a {head_equipment}, a {hand_equipment}, a {chest_equipment}, a {waist_equipment}, and a {foot_equipment}. Please sure to use only medieval items that were possble to be made in that period. Inside the bag also gold coins. Atmospheric light, cavern, dungeon context. Unreal Engine render style, photorealistic, realistic fantasy style."
|
15 |
+
else:
|
16 |
+
pass
|