Spaces:
Runtime error
Runtime error
Update app.py
Browse filesadd image_2 and prompt_2 (no scales)
app.py
CHANGED
|
@@ -25,10 +25,15 @@ pipe_prior_redux = FluxPriorReduxPipeline.from_pretrained(
|
|
| 25 |
).to("cuda")
|
| 26 |
|
| 27 |
@spaces.GPU
|
| 28 |
-
def infer(control_image, prompt, reference_scale= 0.03 ,
|
|
|
|
|
|
|
| 29 |
if randomize_seed:
|
| 30 |
seed = random.randint(0, MAX_SEED)
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
cond_size = 729
|
| 33 |
hidden_size = 4096
|
| 34 |
max_sequence_length = 512
|
|
@@ -75,13 +80,23 @@ An adapter for FLUX [dev] to create image variations
|
|
| 75 |
container=False,
|
| 76 |
)
|
| 77 |
reference_scale = gr.Slider(
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
)
|
| 84 |
run_button = gr.Button("Run")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
result = gr.Image(label="Result", show_label=False)
|
| 86 |
|
| 87 |
with gr.Accordion("Advanced Settings", open=False):
|
|
@@ -135,7 +150,7 @@ An adapter for FLUX [dev] to create image variations
|
|
| 135 |
gr.on(
|
| 136 |
triggers=[run_button.click],
|
| 137 |
fn = infer,
|
| 138 |
-
inputs = [input_image, prompt, reference_scale, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 139 |
outputs = [result, seed]
|
| 140 |
)
|
| 141 |
|
|
|
|
| 25 |
).to("cuda")
|
| 26 |
|
| 27 |
@spaces.GPU
|
| 28 |
+
def infer(control_image, prompt, image_2, prompt_2, reference_scale= 0.03 ,
|
| 29 |
+
seed=42, randomize_seed=False, width=1024, height=1024,
|
| 30 |
+
guidance_scale=3.5, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
|
| 31 |
if randomize_seed:
|
| 32 |
seed = random.randint(0, MAX_SEED)
|
| 33 |
+
if image_2 is not None:
|
| 34 |
+
pipe_prior_output = pipe_prior_redux([control_image, image_2], prompt=[prompt, prompt_2])
|
| 35 |
+
else:
|
| 36 |
+
pipe_prior_output = pipe_prior_redux(control_image, prompt=prompt)
|
| 37 |
cond_size = 729
|
| 38 |
hidden_size = 4096
|
| 39 |
max_sequence_length = 512
|
|
|
|
| 80 |
container=False,
|
| 81 |
)
|
| 82 |
reference_scale = gr.Slider(
|
| 83 |
+
label="Masking Scale",
|
| 84 |
+
minimum=0.01,
|
| 85 |
+
maximum=0.08,
|
| 86 |
+
step=0.001,
|
| 87 |
+
value=0.03,
|
| 88 |
)
|
| 89 |
run_button = gr.Button("Run")
|
| 90 |
+
with gr.Column():
|
| 91 |
+
image_2 = gr.Image(label="2nd image to create interpolated variations", type="pil")
|
| 92 |
+
prompt_2 = gr.Text(
|
| 93 |
+
label="2nd Prompt",
|
| 94 |
+
show_label=False,
|
| 95 |
+
max_lines=1,
|
| 96 |
+
placeholder="Enter your prompt",
|
| 97 |
+
container=False,
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
result = gr.Image(label="Result", show_label=False)
|
| 101 |
|
| 102 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
|
| 150 |
gr.on(
|
| 151 |
triggers=[run_button.click],
|
| 152 |
fn = infer,
|
| 153 |
+
inputs = [input_image, prompt, image_2, prompt_2, reference_scale, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 154 |
outputs = [result, seed]
|
| 155 |
)
|
| 156 |
|