Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,96 +73,100 @@ def load_example():
|
|
| 73 |
example_image = Image.open(example_image_path)
|
| 74 |
return example_prompt, example_cfg_scale, example_steps, True, example_seed, example_width, example_height, example_lora_scale, example_image
|
| 75 |
|
|
|
|
| 76 |
css = """
|
| 77 |
-
.container {max-width:
|
| 78 |
.header {text-align: center; margin-bottom: 30px;}
|
| 79 |
-
.generate-btn {background-color: #2ecc71 !important; color: white !important;}
|
| 80 |
.generate-btn:hover {background-color: #27ae60 !important;}
|
| 81 |
.parameter-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 10px 0;}
|
| 82 |
-
.result-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px;}
|
|
|
|
|
|
|
| 83 |
"""
|
| 84 |
|
| 85 |
with gr.Blocks(css=css) as app:
|
| 86 |
with gr.Column(elem_classes="container"):
|
| 87 |
gr.Markdown("# π¨ Flux ART Image Generator", elem_classes="header")
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
)
|
| 109 |
-
steps = gr.Slider(
|
| 110 |
-
label="Steps",
|
| 111 |
-
minimum=1,
|
| 112 |
-
maximum=100,
|
| 113 |
-
step=1,
|
| 114 |
-
value=example_steps
|
| 115 |
-
)
|
| 116 |
-
lora_scale = gr.Slider(
|
| 117 |
-
label="LoRA Scale",
|
| 118 |
-
minimum=0,
|
| 119 |
-
maximum=1,
|
| 120 |
-
step=0.01,
|
| 121 |
-
value=example_lora_scale
|
| 122 |
-
)
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
height = gr.Slider(
|
| 135 |
-
label="Height",
|
| 136 |
-
minimum=256,
|
| 137 |
-
maximum=1536,
|
| 138 |
-
step=64,
|
| 139 |
-
value=example_height
|
| 140 |
)
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
label="Randomize seed"
|
| 148 |
)
|
| 149 |
-
|
| 150 |
-
label="
|
| 151 |
minimum=0,
|
| 152 |
-
maximum=
|
| 153 |
-
step=
|
| 154 |
-
value=
|
| 155 |
)
|
| 156 |
-
|
| 157 |
-
generate_button = gr.Button(
|
| 158 |
-
"π Generate Image",
|
| 159 |
-
elem_classes="generate-btn"
|
| 160 |
-
)
|
| 161 |
|
| 162 |
-
with gr.
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
app.load(
|
| 168 |
load_example,
|
|
|
|
| 73 |
example_image = Image.open(example_image_path)
|
| 74 |
return example_prompt, example_cfg_scale, example_steps, True, example_seed, example_width, example_height, example_lora_scale, example_image
|
| 75 |
|
| 76 |
+
|
| 77 |
css = """
|
| 78 |
+
.container {max-width: 1400px; margin: auto; padding: 20px;}
|
| 79 |
.header {text-align: center; margin-bottom: 30px;}
|
| 80 |
+
.generate-btn {background-color: #2ecc71 !important; color: white !important; margin: 20px auto !important; display: block !important; width: 200px !important;}
|
| 81 |
.generate-btn:hover {background-color: #27ae60 !important;}
|
| 82 |
.parameter-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 10px 0;}
|
| 83 |
+
.result-box {background-color: #f5f6fa; padding: 20px; border-radius: 10px; margin: 0 auto 20px auto; text-align: center;}
|
| 84 |
+
.image-output {margin: 0 auto; display: block; max-width: 800px !important;}
|
| 85 |
+
.accordion {margin-top: 20px;}
|
| 86 |
"""
|
| 87 |
|
| 88 |
with gr.Blocks(css=css) as app:
|
| 89 |
with gr.Column(elem_classes="container"):
|
| 90 |
gr.Markdown("# π¨ Flux ART Image Generator", elem_classes="header")
|
| 91 |
|
| 92 |
+
# μ΄λ―Έμ§ μΆλ ₯ μμμ λ¨Όμ λ°°μΉ
|
| 93 |
+
with gr.Group(elem_classes="result-box"):
|
| 94 |
+
gr.Markdown("### πΌοΈ Generated Image")
|
| 95 |
+
result = gr.Image(label="Result", elem_classes="image-output")
|
| 96 |
+
|
| 97 |
+
# μμ± λ²νΌ
|
| 98 |
+
generate_button = gr.Button(
|
| 99 |
+
"π Generate Image",
|
| 100 |
+
elem_classes="generate-btn"
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
# μ΅μ
λ€μ μμ½λμΈμΌλ‘ ꡬμ±
|
| 104 |
+
with gr.Accordion("π¨ Generation Options", open=False, elem_classes="accordion"):
|
| 105 |
+
with gr.Group(elem_classes="parameter-box"):
|
| 106 |
+
prompt = gr.TextArea(
|
| 107 |
+
label="βοΈ Your Prompt (νκΈ λλ μμ΄)",
|
| 108 |
+
placeholder="μ΄λ―Έμ§λ₯Ό μ€λͺ
νμΈμ... (νκΈ μ
λ ₯μ μλμΌλ‘ μμ΄λ‘ λ²μλ©λλ€)",
|
| 109 |
+
lines=5
|
| 110 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
with gr.Group(elem_classes="parameter-box"):
|
| 113 |
+
gr.Markdown("### ποΈ Generation Parameters")
|
| 114 |
+
with gr.Row():
|
| 115 |
+
with gr.Column():
|
| 116 |
+
cfg_scale = gr.Slider(
|
| 117 |
+
label="CFG Scale",
|
| 118 |
+
minimum=1,
|
| 119 |
+
maximum=20,
|
| 120 |
+
step=0.5,
|
| 121 |
+
value=example_cfg_scale
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
)
|
| 123 |
+
steps = gr.Slider(
|
| 124 |
+
label="Steps",
|
| 125 |
+
minimum=1,
|
| 126 |
+
maximum=100,
|
| 127 |
+
step=1,
|
| 128 |
+
value=example_steps
|
|
|
|
| 129 |
)
|
| 130 |
+
lora_scale = gr.Slider(
|
| 131 |
+
label="LoRA Scale",
|
| 132 |
minimum=0,
|
| 133 |
+
maximum=1,
|
| 134 |
+
step=0.01,
|
| 135 |
+
value=example_lora_scale
|
| 136 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
with gr.Group(elem_classes="parameter-box"):
|
| 139 |
+
gr.Markdown("### π Image Dimensions")
|
| 140 |
+
with gr.Row():
|
| 141 |
+
width = gr.Slider(
|
| 142 |
+
label="Width",
|
| 143 |
+
minimum=256,
|
| 144 |
+
maximum=1536,
|
| 145 |
+
step=64,
|
| 146 |
+
value=example_width
|
| 147 |
+
)
|
| 148 |
+
height = gr.Slider(
|
| 149 |
+
label="Height",
|
| 150 |
+
minimum=256,
|
| 151 |
+
maximum=1536,
|
| 152 |
+
step=64,
|
| 153 |
+
value=example_height
|
| 154 |
+
)
|
| 155 |
+
|
| 156 |
+
with gr.Group(elem_classes="parameter-box"):
|
| 157 |
+
gr.Markdown("### π² Seed Settings")
|
| 158 |
+
with gr.Row():
|
| 159 |
+
randomize_seed = gr.Checkbox(
|
| 160 |
+
True,
|
| 161 |
+
label="Randomize seed"
|
| 162 |
+
)
|
| 163 |
+
seed = gr.Slider(
|
| 164 |
+
label="Seed",
|
| 165 |
+
minimum=0,
|
| 166 |
+
maximum=MAX_SEED,
|
| 167 |
+
step=1,
|
| 168 |
+
value=example_seed
|
| 169 |
+
)
|
| 170 |
|
| 171 |
app.load(
|
| 172 |
load_example,
|