Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ from optimization import optimize_pipeline_
|
|
| 17 |
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
|
| 20 |
-
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("
|
| 21 |
optimize_pipeline_(pipe, image=Image.new("RGB", (512, 512)), prompt='prompt')
|
| 22 |
|
| 23 |
@spaces.GPU
|
|
@@ -89,18 +89,12 @@ def infer_example(input_image, prompt):
|
|
| 89 |
image, seed, _ = infer(input_image, prompt)
|
| 90 |
return image, seed
|
| 91 |
|
| 92 |
-
css="""
|
| 93 |
-
#col-container {
|
| 94 |
-
margin: 0 auto;
|
| 95 |
-
max-width: 960px;
|
| 96 |
-
}
|
| 97 |
-
"""
|
| 98 |
|
| 99 |
-
with gr.Blocks(
|
| 100 |
|
| 101 |
with gr.Column(elem_id="col-container"):
|
| 102 |
-
gr.Markdown(f"""#
|
| 103 |
-
|
| 104 |
""")
|
| 105 |
with gr.Row():
|
| 106 |
with gr.Column():
|
|
@@ -145,19 +139,6 @@ Image editing and manipulation model guidance-distilled from FLUX.1 Kontext [pro
|
|
| 145 |
with gr.Column():
|
| 146 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
| 147 |
reuse_button = gr.Button("Reuse this image", visible=False)
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
examples = gr.Examples(
|
| 151 |
-
examples=[
|
| 152 |
-
["flowers.png", "turn the flowers into sunflowers"],
|
| 153 |
-
["monster.png", "make this monster ride a skateboard on the beach"],
|
| 154 |
-
["cat.png", "make this cat happy"]
|
| 155 |
-
],
|
| 156 |
-
inputs=[input_image, prompt],
|
| 157 |
-
outputs=[result, seed],
|
| 158 |
-
fn=infer_example,
|
| 159 |
-
cache_examples="lazy"
|
| 160 |
-
)
|
| 161 |
|
| 162 |
gr.on(
|
| 163 |
triggers=[run_button.click, prompt.submit],
|
|
|
|
| 17 |
|
| 18 |
MAX_SEED = np.iinfo(np.int32).max
|
| 19 |
|
| 20 |
+
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cpu")
|
| 21 |
optimize_pipeline_(pipe, image=Image.new("RGB", (512, 512)), prompt='prompt')
|
| 22 |
|
| 23 |
@spaces.GPU
|
|
|
|
| 89 |
image, seed, _ = infer(input_image, prompt)
|
| 90 |
return image, seed
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
+
with gr.Blocks(theme="Yntec/HaleyCH_Theme_Orange") as demo:
|
| 94 |
|
| 95 |
with gr.Column(elem_id="col-container"):
|
| 96 |
+
gr.Markdown(f"""# Image Editor
|
| 97 |
+
⚠ Sorry for the inconvenience. The Space is currently running on the CPU, which might affect performance. We appreciate your understanding.
|
| 98 |
""")
|
| 99 |
with gr.Row():
|
| 100 |
with gr.Column():
|
|
|
|
| 139 |
with gr.Column():
|
| 140 |
result = gr.Image(label="Result", show_label=False, interactive=False)
|
| 141 |
reuse_button = gr.Button("Reuse this image", visible=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
gr.on(
|
| 144 |
triggers=[run_button.click, prompt.submit],
|