Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,7 +24,7 @@ pipe = Flux2Pipeline.from_pretrained(
|
|
| 24 |
)
|
| 25 |
|
| 26 |
# Enable memory optimizations for ZeroGPU
|
| 27 |
-
pipe.enable_model_cpu_offload()
|
| 28 |
|
| 29 |
print("Pipeline loaded successfully!")
|
| 30 |
|
|
@@ -53,7 +53,7 @@ def update_dimensions_from_image(image_list):
|
|
| 53 |
|
| 54 |
return new_width, new_height
|
| 55 |
|
| 56 |
-
@spaces.GPU(duration=60)
|
| 57 |
def infer(prompt, input_images=None, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=50, guidance_scale=2.5, progress=gr.Progress(track_tqdm=True)):
|
| 58 |
|
| 59 |
if randomize_seed:
|
|
@@ -99,20 +99,20 @@ examples_images = [
|
|
| 99 |
["The person from image 1 is petting the cat from image 2, the bird from image 3 is next to them", ["woman1.webp", "cat_window.webp", "bird.webp"]]
|
| 100 |
]
|
| 101 |
|
| 102 |
-
css="""
|
| 103 |
#col-container {
|
| 104 |
margin: 0 auto;
|
| 105 |
max-width: 1200px;
|
| 106 |
}
|
| 107 |
-
.gallery-container img{
|
| 108 |
object-fit: contain;
|
| 109 |
}
|
| 110 |
"""
|
| 111 |
|
| 112 |
-
with gr.Blocks(
|
| 113 |
|
| 114 |
with gr.Column(elem_id="col-container"):
|
| 115 |
-
gr.Markdown(
|
| 116 |
FLUX.2 [dev] is a 32B model rectified flow capable of generating, editing and combining images based on text instructions model [[model](https://huggingface.co/black-forest-labs/FLUX.2-dev)], [[blog](https://bfl.ai/blog/flux-2)]
|
| 117 |
""")
|
| 118 |
with gr.Row():
|
|
@@ -214,4 +214,4 @@ FLUX.2 [dev] is a 32B model rectified flow capable of generating, editing and co
|
|
| 214 |
outputs=[result, seed]
|
| 215 |
)
|
| 216 |
|
| 217 |
-
demo.launch()
|
|
|
|
| 24 |
)
|
| 25 |
|
| 26 |
# Enable memory optimizations for ZeroGPU
|
| 27 |
+
pipe.enable_model_cpu_offload()
|
| 28 |
|
| 29 |
print("Pipeline loaded successfully!")
|
| 30 |
|
|
|
|
| 53 |
|
| 54 |
return new_width, new_height
|
| 55 |
|
| 56 |
+
@spaces.GPU(duration=60)
|
| 57 |
def infer(prompt, input_images=None, seed=42, randomize_seed=False, width=1024, height=1024, num_inference_steps=50, guidance_scale=2.5, progress=gr.Progress(track_tqdm=True)):
|
| 58 |
|
| 59 |
if randomize_seed:
|
|
|
|
| 99 |
["The person from image 1 is petting the cat from image 2, the bird from image 3 is next to them", ["woman1.webp", "cat_window.webp", "bird.webp"]]
|
| 100 |
]
|
| 101 |
|
| 102 |
+
css = """
|
| 103 |
#col-container {
|
| 104 |
margin: 0 auto;
|
| 105 |
max-width: 1200px;
|
| 106 |
}
|
| 107 |
+
.gallery-container img {
|
| 108 |
object-fit: contain;
|
| 109 |
}
|
| 110 |
"""
|
| 111 |
|
| 112 |
+
with gr.Blocks() as demo:
|
| 113 |
|
| 114 |
with gr.Column(elem_id="col-container"):
|
| 115 |
+
gr.Markdown("""# FLUX.2 [dev]
|
| 116 |
FLUX.2 [dev] is a 32B model rectified flow capable of generating, editing and combining images based on text instructions model [[model](https://huggingface.co/black-forest-labs/FLUX.2-dev)], [[blog](https://bfl.ai/blog/flux-2)]
|
| 117 |
""")
|
| 118 |
with gr.Row():
|
|
|
|
| 214 |
outputs=[result, seed]
|
| 215 |
)
|
| 216 |
|
| 217 |
+
demo.launch(css=css)
|