Spaces:
Runtime error
Runtime error
UI revamp suggestions (#1)
Browse files- UI revamp suggestions (257cb56ed8afce3a5843ae82f552d5e9a82da070)
Co-authored-by: Apolinário from multimodal AI art <[email protected]>
app.py
CHANGED
|
@@ -22,7 +22,7 @@ pipeline.set_adapters(["hyper-sd"], adapter_weights=[0.125])
|
|
| 22 |
# The function for our Gradio app #
|
| 23 |
#####################################
|
| 24 |
@spaces.GPU(duration=120)
|
| 25 |
-
def generate(prompt, input_image):
|
| 26 |
"""
|
| 27 |
Runs the Flux Control pipeline for editing the given `input_image`
|
| 28 |
with the specified `prompt`. The pipeline is on CPU by default.
|
|
@@ -42,32 +42,32 @@ def generate(prompt, input_image):
|
|
| 42 |
|
| 43 |
|
| 44 |
def launch_app():
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
| 46 |
gr.Markdown(
|
| 47 |
"""
|
| 48 |
# Flux Control Editing 🖌️
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
**Acknowledgements**:
|
| 54 |
-
- [Sayak Paul](https://huggingface.co/sayakpaul) for open-sourcing FLUX.1-dev-edit-v0
|
| 55 |
-
- [black-forest-labs](https://huggingface.co/black-forest-labs) for FLUX.1-dev
|
| 56 |
"""
|
| 57 |
)
|
| 58 |
-
|
| 59 |
with gr.Row():
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
|
| 72 |
# Connect button to function
|
| 73 |
generate_button.click(
|
|
@@ -82,8 +82,17 @@ def launch_app():
|
|
| 82 |
["Make the mushroom polka-dotted", "mushroom.jpg"],
|
| 83 |
],
|
| 84 |
inputs=[prompt, input_image],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
)
|
| 86 |
-
|
| 87 |
return demo
|
| 88 |
|
| 89 |
|
|
|
|
| 22 |
# The function for our Gradio app #
|
| 23 |
#####################################
|
| 24 |
@spaces.GPU(duration=120)
|
| 25 |
+
def generate(prompt, input_image, progress=gr.Progress(track_tqdm=True)):
|
| 26 |
"""
|
| 27 |
Runs the Flux Control pipeline for editing the given `input_image`
|
| 28 |
with the specified `prompt`. The pipeline is on CPU by default.
|
|
|
|
| 42 |
|
| 43 |
|
| 44 |
def launch_app():
|
| 45 |
+
css = '''
|
| 46 |
+
.gradio-container{max-width: 1100px !important}
|
| 47 |
+
'''
|
| 48 |
+
with gr.Blocks(css=css) as demo:
|
| 49 |
gr.Markdown(
|
| 50 |
"""
|
| 51 |
# Flux Control Editing 🖌️
|
| 52 |
|
| 53 |
+
Edit any image with the [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev)
|
| 54 |
+
[Flux Control edit framework](https://github.com/sayakpaul/flux-image-editing) by [Sayak Paul](https://huggingface.co/sayakpaul).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
"""
|
| 56 |
)
|
|
|
|
| 57 |
with gr.Row():
|
| 58 |
+
with gr.Column():
|
| 59 |
+
with gr.Group():
|
| 60 |
+
input_image = gr.Image(
|
| 61 |
+
label="Image you would like to edit",
|
| 62 |
+
type="pil",
|
| 63 |
+
)
|
| 64 |
+
prompt = gr.Textbox(
|
| 65 |
+
label="Your edit prompt",
|
| 66 |
+
placeholder="e.g. 'Turn the color of the mushroom to blue'"
|
| 67 |
+
)
|
| 68 |
+
generate_button = gr.Button("Generate")
|
| 69 |
+
|
| 70 |
+
output_image = gr.Image(label="Edited Image")
|
| 71 |
|
| 72 |
# Connect button to function
|
| 73 |
generate_button.click(
|
|
|
|
| 82 |
["Make the mushroom polka-dotted", "mushroom.jpg"],
|
| 83 |
],
|
| 84 |
inputs=[prompt, input_image],
|
| 85 |
+
outputs=[output_image],
|
| 86 |
+
fn=generate,
|
| 87 |
+
cache_examples="lazy"
|
| 88 |
+
)
|
| 89 |
+
gr.Markdown(
|
| 90 |
+
"""
|
| 91 |
+
**Acknowledgements**:
|
| 92 |
+
- [Sayak Paul](https://huggingface.co/sayakpaul) for open-sourcing FLUX.1-dev-edit-v0
|
| 93 |
+
- [black-forest-labs](https://huggingface.co/black-forest-labs) for FLUX.1-dev
|
| 94 |
+
"""
|
| 95 |
)
|
|
|
|
| 96 |
return demo
|
| 97 |
|
| 98 |
|