Spaces:
Build error
Build error
Commit
·
bba17cc
1
Parent(s):
b0a0e6f
Added types for fusion
Browse files
app.py
CHANGED
|
@@ -9,6 +9,8 @@ MAX_IMAGES = 1
|
|
| 9 |
|
| 10 |
|
| 11 |
def generate_images(
|
|
|
|
|
|
|
| 12 |
hp_num: int,
|
| 13 |
attack_num: int,
|
| 14 |
defense_num: int,
|
|
@@ -33,7 +35,7 @@ def generate_images(
|
|
| 33 |
hp_num + attack_num + defense_num + sp_attack_num + sp_defense_num + speed_num
|
| 34 |
)
|
| 35 |
# Create the text prompt
|
| 36 |
-
prompt = f"type1:
|
| 37 |
# Generate the images
|
| 38 |
for _ in range(MAX_IMAGES):
|
| 39 |
image = pipe(
|
|
@@ -77,8 +79,56 @@ with demo:
|
|
| 77 |
with gr.Column():
|
| 78 |
with gr.Row():
|
| 79 |
gallery = gr.Gallery(
|
| 80 |
-
columns=MAX_IMAGES,
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
)
|
| 83 |
with gr.Row():
|
| 84 |
hp_num = gr.Slider(
|
|
@@ -125,10 +175,12 @@ with demo:
|
|
| 125 |
step=1,
|
| 126 |
label="Speed",
|
| 127 |
)
|
| 128 |
-
|
| 129 |
-
|
| 130 |
fn=generate_images,
|
| 131 |
inputs=[
|
|
|
|
|
|
|
| 132 |
hp_num,
|
| 133 |
attack_num,
|
| 134 |
defense_num,
|
|
|
|
| 9 |
|
| 10 |
|
| 11 |
def generate_images(
|
| 12 |
+
type1: str,
|
| 13 |
+
type2: str,
|
| 14 |
hp_num: int,
|
| 15 |
attack_num: int,
|
| 16 |
defense_num: int,
|
|
|
|
| 35 |
hp_num + attack_num + defense_num + sp_attack_num + sp_defense_num + speed_num
|
| 36 |
)
|
| 37 |
# Create the text prompt
|
| 38 |
+
prompt = f"type1: {type1}, type2: {type2}, base_total: {base_total}, hp: {hp_num}, attack: {attack_num}, defense: {defense_num}, sp_attack: {sp_attack_num}, sp_defense: {sp_defense_num}, speed: {speed_num}"
|
| 39 |
# Generate the images
|
| 40 |
for _ in range(MAX_IMAGES):
|
| 41 |
image = pipe(
|
|
|
|
| 79 |
with gr.Column():
|
| 80 |
with gr.Row():
|
| 81 |
gallery = gr.Gallery(
|
| 82 |
+
columns=MAX_IMAGES, preview=True, object_fit="scale-down"
|
| 83 |
+
)
|
| 84 |
+
with gr.Row():
|
| 85 |
+
type1 = gr.Dropdown(
|
| 86 |
+
[
|
| 87 |
+
"bug",
|
| 88 |
+
"dark",
|
| 89 |
+
"dragon",
|
| 90 |
+
"electric",
|
| 91 |
+
"fairy",
|
| 92 |
+
"fighting",
|
| 93 |
+
"fire",
|
| 94 |
+
"flying",
|
| 95 |
+
"ghost",
|
| 96 |
+
"grass",
|
| 97 |
+
"ground",
|
| 98 |
+
"ice",
|
| 99 |
+
"normal",
|
| 100 |
+
"poison",
|
| 101 |
+
"psychic",
|
| 102 |
+
"rock",
|
| 103 |
+
"steel",
|
| 104 |
+
"water",
|
| 105 |
+
],
|
| 106 |
+
value="steel",
|
| 107 |
+
label="Type 1",
|
| 108 |
+
)
|
| 109 |
+
type2 = gr.Dropdown(
|
| 110 |
+
[
|
| 111 |
+
"bug",
|
| 112 |
+
"dark",
|
| 113 |
+
"dragon",
|
| 114 |
+
"electric",
|
| 115 |
+
"fairy",
|
| 116 |
+
"fighting",
|
| 117 |
+
"fire",
|
| 118 |
+
"flying",
|
| 119 |
+
"ghost",
|
| 120 |
+
"grass",
|
| 121 |
+
"ground",
|
| 122 |
+
"ice",
|
| 123 |
+
"normal",
|
| 124 |
+
"poison",
|
| 125 |
+
"psychic",
|
| 126 |
+
"rock",
|
| 127 |
+
"steel",
|
| 128 |
+
"water",
|
| 129 |
+
],
|
| 130 |
+
value="fire",
|
| 131 |
+
label="Type 2",
|
| 132 |
)
|
| 133 |
with gr.Row():
|
| 134 |
hp_num = gr.Slider(
|
|
|
|
| 175 |
step=1,
|
| 176 |
label="Speed",
|
| 177 |
)
|
| 178 |
+
gen_btn = gr.Button("Generate")
|
| 179 |
+
gen_btn.click(
|
| 180 |
fn=generate_images,
|
| 181 |
inputs=[
|
| 182 |
+
type1,
|
| 183 |
+
type2,
|
| 184 |
hp_num,
|
| 185 |
attack_num,
|
| 186 |
defense_num,
|