Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -63,13 +63,14 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
63 |
input_image = input_image.convert("RGB")
|
64 |
original_width, original_height = input_image.width, input_image.height
|
65 |
now_width, now_height = input_image.width, input_image.height
|
|
|
66 |
if input_image.height // input_image.width >= 5 or input_image.width // input_image.height >= 5:
|
67 |
if input_image.height < input_image.width:
|
68 |
-
input_image.resize((original_width, original_height *
|
69 |
-
now_width, now_height = input_image.width, input_image.height *
|
70 |
else:
|
71 |
-
input_image.resize((original_width *
|
72 |
-
now_width, now_height = input_image.width *
|
73 |
image = pipe(
|
74 |
image=input_image,
|
75 |
prompt=prompt,
|
@@ -102,8 +103,8 @@ css="""
|
|
102 |
with gr.Blocks(css=css) as demo:
|
103 |
|
104 |
with gr.Column(elem_id="col-container"):
|
105 |
-
gr.Markdown(f"""#
|
106 |
-
|
107 |
Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro], [[blog]](https://bfl.ai/announcements/flux-1-kontext-dev) [[model]](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev)
|
108 |
""")
|
109 |
with gr.Row():
|
|
|
63 |
input_image = input_image.convert("RGB")
|
64 |
original_width, original_height = input_image.width, input_image.height
|
65 |
now_width, now_height = input_image.width, input_image.height
|
66 |
+
scale = 4
|
67 |
if input_image.height // input_image.width >= 5 or input_image.width // input_image.height >= 5:
|
68 |
if input_image.height < input_image.width:
|
69 |
+
input_image.resize((original_width, original_height * scale ))
|
70 |
+
now_width, now_height = input_image.width, input_image.height * scale
|
71 |
else:
|
72 |
+
input_image.resize((original_width * scale, original_height))
|
73 |
+
now_width, now_height = input_image.width * scale, input_image.height
|
74 |
image = pipe(
|
75 |
image=input_image,
|
76 |
prompt=prompt,
|
|
|
103 |
with gr.Blocks(css=css) as demo:
|
104 |
|
105 |
with gr.Column(elem_id="col-container"):
|
106 |
+
gr.Markdown(f"""# FLUX.1 Kontext [dev]
|
107 |
+
当上传参考图后,不能自定义输出尺寸,输出尺寸默认和输入图像的尺寸相同。
|
108 |
Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro], [[blog]](https://bfl.ai/announcements/flux-1-kontext-dev) [[model]](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev)
|
109 |
""")
|
110 |
with gr.Row():
|