Spaces:
Running
on
Zero
Running
on
Zero
small UI improvements (#1)
Browse files- small UI improvements (9787b7fb98216b408f0b7a1c7b492a21847417d5)
- Update app.py (b1736db9566b36961db84342b2afc56ced67578c)
Co-authored-by: Linoy Tsaban <[email protected]>
app.py
CHANGED
|
@@ -129,36 +129,35 @@ examples = [
|
|
| 129 |
with gr.Blocks() as demo:
|
| 130 |
with gr.Column(elem_id="col-container"):
|
| 131 |
gr.HTML('<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/layered/qwen-image-layered-logo.png" alt="Qwen-Image-Layered Logo" width="600" style="display: block; margin: 0 auto;">')
|
|
|
|
| 132 |
with gr.Row():
|
| 133 |
-
with gr.Column():
|
| 134 |
input_image = gr.Image(label="Input Image", image_mode="RGBA")
|
| 135 |
|
| 136 |
-
with gr.Column():
|
| 137 |
-
seed = gr.Slider(
|
| 138 |
-
label="Seed",
|
| 139 |
-
minimum=0,
|
| 140 |
-
maximum=MAX_SEED,
|
| 141 |
-
step=1,
|
| 142 |
-
value=0,
|
| 143 |
-
)
|
| 144 |
-
|
| 145 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 146 |
-
|
| 147 |
-
|
| 148 |
prompt = gr.Textbox(
|
| 149 |
label="Prompt (Optional)",
|
| 150 |
placeholder="Please enter the prompt to guide the decomposition (Optional)",
|
| 151 |
value="",
|
| 152 |
lines=2,
|
| 153 |
)
|
| 154 |
-
neg_prompt = gr.Textbox(
|
| 155 |
-
label="Negative Prompt (Optional)",
|
| 156 |
-
placeholder="Please enter the negative prompt",
|
| 157 |
-
value=" ",
|
| 158 |
-
lines=2,
|
| 159 |
-
)
|
| 160 |
|
| 161 |
-
with gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
true_guidance_scale = gr.Slider(
|
| 163 |
label="True guidance scale",
|
| 164 |
minimum=1.0,
|
|
@@ -183,29 +182,29 @@ with gr.Blocks() as demo:
|
|
| 183 |
value=4,
|
| 184 |
)
|
| 185 |
|
| 186 |
-
with gr.Row():
|
| 187 |
cfg_norm = gr.Checkbox(label="Whether enable CFG normalization", value=True)
|
| 188 |
use_en_prompt = gr.Checkbox(label="Automatic caption language if no prompt provided, True for EN, False for ZH", value=True)
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
export_btn.click(
|
| 197 |
-
fn=export_gallery,
|
| 198 |
-
inputs=gallery,
|
| 199 |
-
outputs=export_file
|
| 200 |
-
)
|
| 201 |
|
| 202 |
gr.Examples(examples=examples,
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
)
|
| 210 |
|
| 211 |
run_button.click(
|
|
|
|
| 129 |
with gr.Blocks() as demo:
|
| 130 |
with gr.Column(elem_id="col-container"):
|
| 131 |
gr.HTML('<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/layered/qwen-image-layered-logo.png" alt="Qwen-Image-Layered Logo" width="600" style="display: block; margin: 0 auto;">')
|
| 132 |
+
|
| 133 |
with gr.Row():
|
| 134 |
+
with gr.Column(scale=1):
|
| 135 |
input_image = gr.Image(label="Input Image", image_mode="RGBA")
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
prompt = gr.Textbox(
|
| 138 |
label="Prompt (Optional)",
|
| 139 |
placeholder="Please enter the prompt to guide the decomposition (Optional)",
|
| 140 |
value="",
|
| 141 |
lines=2,
|
| 142 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 145 |
+
neg_prompt = gr.Textbox(
|
| 146 |
+
label="Negative Prompt (Optional)",
|
| 147 |
+
placeholder="Please enter the negative prompt",
|
| 148 |
+
value=" ",
|
| 149 |
+
lines=2,
|
| 150 |
+
)
|
| 151 |
+
|
| 152 |
+
seed = gr.Slider(
|
| 153 |
+
label="Seed",
|
| 154 |
+
minimum=0,
|
| 155 |
+
maximum=MAX_SEED,
|
| 156 |
+
step=1,
|
| 157 |
+
value=0,
|
| 158 |
+
)
|
| 159 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 160 |
+
|
| 161 |
true_guidance_scale = gr.Slider(
|
| 162 |
label="True guidance scale",
|
| 163 |
minimum=1.0,
|
|
|
|
| 182 |
value=4,
|
| 183 |
)
|
| 184 |
|
|
|
|
| 185 |
cfg_norm = gr.Checkbox(label="Whether enable CFG normalization", value=True)
|
| 186 |
use_en_prompt = gr.Checkbox(label="Automatic caption language if no prompt provided, True for EN, False for ZH", value=True)
|
| 187 |
|
| 188 |
+
run_button = gr.Button("Decompose!", variant="primary")
|
| 189 |
+
|
| 190 |
+
with gr.Column(scale=1):
|
| 191 |
+
gallery = gr.Gallery(label="Layers", columns=4, rows=1, format="png")
|
| 192 |
+
export_btn = gr.Button("Export as PPTX")
|
| 193 |
+
export_file = gr.File(label="Download PPTX")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
|
| 195 |
gr.Examples(examples=examples,
|
| 196 |
+
inputs=[input_image],
|
| 197 |
+
outputs=[gallery],
|
| 198 |
+
fn=infer,
|
| 199 |
+
examples_per_page=14,
|
| 200 |
+
cache_examples=False,
|
| 201 |
+
run_on_click=True
|
| 202 |
+
)
|
| 203 |
+
|
| 204 |
+
export_btn.click(
|
| 205 |
+
fn=export_gallery,
|
| 206 |
+
inputs=gallery,
|
| 207 |
+
outputs=export_file
|
| 208 |
)
|
| 209 |
|
| 210 |
run_button.click(
|