Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -74,12 +74,7 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
74 |
num_inference_steps=steps,
|
75 |
generator=torch.Generator().manual_seed(seed),
|
76 |
).images[0]
|
77 |
-
return image, seed
|
78 |
-
|
79 |
-
@spaces.GPU
|
80 |
-
def infer_example(input_image, prompt):
|
81 |
-
image, seed, _ = infer(input_image, prompt)
|
82 |
-
return image, seed
|
83 |
|
84 |
css="""
|
85 |
#col-container {
|
@@ -135,8 +130,7 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
|
|
135 |
)
|
136 |
|
137 |
with gr.Column():
|
138 |
-
result = gr.
|
139 |
-
reuse_button = gr.Button("Reuse this image", visible=False)
|
140 |
|
141 |
|
142 |
examples = gr.Examples(
|
@@ -147,7 +141,7 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
|
|
147 |
],
|
148 |
inputs=[input_image, prompt],
|
149 |
outputs=[result, seed],
|
150 |
-
fn=
|
151 |
cache_examples="lazy"
|
152 |
)
|
153 |
|
@@ -157,10 +151,5 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
|
|
157 |
inputs = [input_image, prompt, seed, randomize_seed, guidance_scale, steps],
|
158 |
outputs = [result, seed, reuse_button]
|
159 |
)
|
160 |
-
reuse_button.click(
|
161 |
-
fn = lambda image: image,
|
162 |
-
inputs = [result],
|
163 |
-
outputs = [input_image]
|
164 |
-
)
|
165 |
|
166 |
demo.launch(mcp_server=True)
|
|
|
74 |
num_inference_steps=steps,
|
75 |
generator=torch.Generator().manual_seed(seed),
|
76 |
).images[0]
|
77 |
+
return (input_image, image), seed
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
css="""
|
80 |
#col-container {
|
|
|
130 |
)
|
131 |
|
132 |
with gr.Column():
|
133 |
+
result = gr.ImageSlider(label="Result", show_label=False, interactive=False)
|
|
|
134 |
|
135 |
|
136 |
examples = gr.Examples(
|
|
|
141 |
],
|
142 |
inputs=[input_image, prompt],
|
143 |
outputs=[result, seed],
|
144 |
+
fn=infer,
|
145 |
cache_examples="lazy"
|
146 |
)
|
147 |
|
|
|
151 |
inputs = [input_image, prompt, seed, randomize_seed, guidance_scale, steps],
|
152 |
outputs = [result, seed, reuse_button]
|
153 |
)
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
demo.launch(mcp_server=True)
|