Update app.py
Browse files
app.py
CHANGED
|
@@ -639,7 +639,7 @@ with EmptyInitWrapper():
|
|
| 639 |
@spaces.GPU(duration=70)
|
| 640 |
@torch.no_grad()
|
| 641 |
def generate_image(
|
| 642 |
-
prompt, neg_prompt, width, height, guidance, seed,
|
| 643 |
do_img2img, init_image, image2image_strength, resize_img,
|
| 644 |
progress=gr.Progress(track_tqdm=True),
|
| 645 |
):
|
|
@@ -664,7 +664,7 @@ def generate_image(
|
|
| 664 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 665 |
x = torch.randn(1, 16, 2 * math.ceil(height / 16), 2 * math.ceil(width / 16), device=device, dtype=torch.bfloat16, generator=generator)
|
| 666 |
|
| 667 |
-
num_steps = 28
|
| 668 |
timesteps = get_schedule(num_steps, (x.shape[-1] * x.shape[-2]) // 4, shift=True)
|
| 669 |
|
| 670 |
if do_img2img and init_image is not None:
|
|
@@ -696,6 +696,7 @@ def create_demo():
|
|
| 696 |
with gr.Column():
|
| 697 |
prompt = gr.Textbox(label="Prompt", value="a photo of a forest with mist swirling around the tree trunks. The word 'FLUX' is painted over it in big, red brush strokes with visible texture")
|
| 698 |
neg_prompt = gr.Textbox(label="Negative Prompt", value="bad photo")
|
|
|
|
| 699 |
width = gr.Slider(minimum=128, maximum=2048, step=64, label="Width", value=1360)
|
| 700 |
height = gr.Slider(minimum=128, maximum=2048, step=64, label="Height", value=768)
|
| 701 |
guidance = gr.Slider(minimum=1.0, maximum=5.0, step=0.1, label="Guidance", value=3.5)
|
|
@@ -718,7 +719,7 @@ def create_demo():
|
|
| 718 |
|
| 719 |
generate_button.click(
|
| 720 |
fn=generate_image,
|
| 721 |
-
inputs=[prompt, neg_prompt, width, height, guidance, seed, do_img2img, init_image, image2image_strength, resize_img],
|
| 722 |
outputs=[output_image, output_seed]
|
| 723 |
)
|
| 724 |
|
|
|
|
| 639 |
@spaces.GPU(duration=70)
|
| 640 |
@torch.no_grad()
|
| 641 |
def generate_image(
|
| 642 |
+
prompt, neg_prompt,num_steps ,width, height, guidance, seed,
|
| 643 |
do_img2img, init_image, image2image_strength, resize_img,
|
| 644 |
progress=gr.Progress(track_tqdm=True),
|
| 645 |
):
|
|
|
|
| 664 |
generator = torch.Generator(device=device).manual_seed(seed)
|
| 665 |
x = torch.randn(1, 16, 2 * math.ceil(height / 16), 2 * math.ceil(width / 16), device=device, dtype=torch.bfloat16, generator=generator)
|
| 666 |
|
| 667 |
+
# num_steps = 28
|
| 668 |
timesteps = get_schedule(num_steps, (x.shape[-1] * x.shape[-2]) // 4, shift=True)
|
| 669 |
|
| 670 |
if do_img2img and init_image is not None:
|
|
|
|
| 696 |
with gr.Column():
|
| 697 |
prompt = gr.Textbox(label="Prompt", value="a photo of a forest with mist swirling around the tree trunks. The word 'FLUX' is painted over it in big, red brush strokes with visible texture")
|
| 698 |
neg_prompt = gr.Textbox(label="Negative Prompt", value="bad photo")
|
| 699 |
+
num_steps = gr.Slider(minimum=1, maximum=30, step=10, label="num_steps", value=10)
|
| 700 |
width = gr.Slider(minimum=128, maximum=2048, step=64, label="Width", value=1360)
|
| 701 |
height = gr.Slider(minimum=128, maximum=2048, step=64, label="Height", value=768)
|
| 702 |
guidance = gr.Slider(minimum=1.0, maximum=5.0, step=0.1, label="Guidance", value=3.5)
|
|
|
|
| 719 |
|
| 720 |
generate_button.click(
|
| 721 |
fn=generate_image,
|
| 722 |
+
inputs=[prompt, neg_prompt, num_steps,width, height, guidance, seed, do_img2img, init_image, image2image_strength, resize_img],
|
| 723 |
outputs=[output_image, output_seed]
|
| 724 |
)
|
| 725 |
|