Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ MAX_SEED = np.iinfo(np.int32).max
|
|
20 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
|
21 |
optimize_pipeline_(pipe, image=Image.new("RGB", (512, 512)), prompt='prompt')
|
22 |
|
23 |
-
@spaces.GPU
|
24 |
def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5, steps=28, progress=gr.Progress(track_tqdm=True)):
|
25 |
"""
|
26 |
Perform image editing using the FLUX.1 Kontext pipeline.
|
@@ -84,7 +84,7 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
84 |
).images[0]
|
85 |
return image, seed, gr.Button(visible=True)
|
86 |
|
87 |
-
@spaces.GPU
|
88 |
def infer_example(input_image, prompt):
|
89 |
image, seed, _ = infer(input_image, prompt)
|
90 |
return image, seed
|
@@ -171,4 +171,4 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
|
|
171 |
outputs = [input_image]
|
172 |
)
|
173 |
|
174 |
-
demo.launch(mcp_server=True)
|
|
|
20 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
|
21 |
optimize_pipeline_(pipe, image=Image.new("RGB", (512, 512)), prompt='prompt')
|
22 |
|
23 |
+
@spaces.GPU(duration=24)
|
24 |
def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5, steps=28, progress=gr.Progress(track_tqdm=True)):
|
25 |
"""
|
26 |
Perform image editing using the FLUX.1 Kontext pipeline.
|
|
|
84 |
).images[0]
|
85 |
return image, seed, gr.Button(visible=True)
|
86 |
|
87 |
+
@spaces.GPU(duration=25)
|
88 |
def infer_example(input_image, prompt):
|
89 |
image, seed, _ = infer(input_image, prompt)
|
90 |
return image, seed
|
|
|
171 |
outputs = [input_image]
|
172 |
)
|
173 |
|
174 |
+
demo.queue(api_open=True).launch(show_error=True, show_api=True, mcp_server=True)
|