Update app.py
Browse files
app.py
CHANGED
|
@@ -18,8 +18,9 @@ else:
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 1024
|
| 20 |
|
| 21 |
-
def infer(
|
| 22 |
-
|
|
|
|
| 23 |
if randomize_seed:
|
| 24 |
seed = random.randint(0, MAX_SEED)
|
| 25 |
|
|
@@ -65,12 +66,46 @@ with gr.Blocks(css=css) as demo:
|
|
| 65 |
|
| 66 |
with gr.Row():
|
| 67 |
|
| 68 |
-
|
| 69 |
-
label="Prompt",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
show_label=False,
|
| 71 |
max_lines=1,
|
| 72 |
-
placeholder="Enter
|
| 73 |
container=False,
|
|
|
|
| 74 |
)
|
| 75 |
|
| 76 |
run_button = gr.Button("Run", scale=0)
|
|
@@ -134,13 +169,13 @@ with gr.Blocks(css=css) as demo:
|
|
| 134 |
|
| 135 |
gr.Examples(
|
| 136 |
examples = examples,
|
| 137 |
-
inputs = [
|
| 138 |
)
|
| 139 |
|
| 140 |
run_button.click(
|
| 141 |
fn = infer,
|
| 142 |
-
inputs = [
|
| 143 |
outputs = [result]
|
| 144 |
)
|
| 145 |
|
| 146 |
-
demo.queue().launch()
|
|
|
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
MAX_IMAGE_SIZE = 1024
|
| 20 |
|
| 21 |
+
def infer(prompt_part1, prompt_part2, prompt_part3, prompt_part4, prompt_part5, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
| 22 |
+
prompt = f"{prompt_part1} {prompt_part2} {prompt_part3} {prompt_part4} {prompt_part5}"
|
| 23 |
+
|
| 24 |
if randomize_seed:
|
| 25 |
seed = random.randint(0, MAX_SEED)
|
| 26 |
|
|
|
|
| 66 |
|
| 67 |
with gr.Row():
|
| 68 |
|
| 69 |
+
prompt_part1 = gr.Text(
|
| 70 |
+
label="Prompt Part 1",
|
| 71 |
+
show_label=False,
|
| 72 |
+
max_lines=1,
|
| 73 |
+
placeholder="Enter prompt part 1",
|
| 74 |
+
container=False,
|
| 75 |
+
value="a single",
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
prompt_part2 = gr.Text(
|
| 79 |
+
label="Prompt Part 2",
|
| 80 |
+
show_label=False,
|
| 81 |
+
max_lines=1,
|
| 82 |
+
placeholder="Enter prompt part 2 (e.g., color category)",
|
| 83 |
+
container=False,
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
prompt_part3 = gr.Text(
|
| 87 |
+
label="Prompt Part 3",
|
| 88 |
+
show_label=False,
|
| 89 |
+
max_lines=1,
|
| 90 |
+
placeholder="Enter prompt part 3 (e.g., t-shirt, sweatshirt, shirt, hoodie)",
|
| 91 |
+
container=False,
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
prompt_part4 = gr.Text(
|
| 95 |
+
label="Prompt Part 4",
|
| 96 |
+
show_label=False,
|
| 97 |
+
max_lines=1,
|
| 98 |
+
placeholder="Enter design prompt",
|
| 99 |
+
container=False,
|
| 100 |
+
)
|
| 101 |
+
|
| 102 |
+
prompt_part5 = gr.Text(
|
| 103 |
+
label="Prompt Part 5",
|
| 104 |
show_label=False,
|
| 105 |
max_lines=1,
|
| 106 |
+
placeholder="Enter prompt part 5",
|
| 107 |
container=False,
|
| 108 |
+
value="hanging on the plain grey wall",
|
| 109 |
)
|
| 110 |
|
| 111 |
run_button = gr.Button("Run", scale=0)
|
|
|
|
| 169 |
|
| 170 |
gr.Examples(
|
| 171 |
examples = examples,
|
| 172 |
+
inputs = [prompt_part1]
|
| 173 |
)
|
| 174 |
|
| 175 |
run_button.click(
|
| 176 |
fn = infer,
|
| 177 |
+
inputs = [prompt_part1, prompt_part2, prompt_part3, prompt_part4, prompt_part5, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 178 |
outputs = [result]
|
| 179 |
)
|
| 180 |
|
| 181 |
+
demo.queue().launch()
|