Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -125,7 +125,7 @@ body {
|
|
125 |
background-color: #f0f4f8;
|
126 |
}
|
127 |
.container {
|
128 |
-
max-width:
|
129 |
margin: 0 auto;
|
130 |
padding: 20px;
|
131 |
background-color: white;
|
@@ -141,6 +141,7 @@ h1 {
|
|
141 |
border: 1px solid #bdc3c7;
|
142 |
border-radius: 5px;
|
143 |
padding: 10px;
|
|
|
144 |
}
|
145 |
.input-box:focus, .output-box:focus {
|
146 |
border-color: #3498db;
|
@@ -158,23 +159,40 @@ h1 {
|
|
158 |
.submit-btn:hover {
|
159 |
background-color: #3498db;
|
160 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
"""
|
162 |
|
163 |
|
164 |
# Gradio Interface
|
165 |
with gr.Blocks(css=css) as demo:
|
166 |
-
gr.Markdown("#
|
167 |
|
168 |
with gr.Row():
|
169 |
-
with gr.Column():
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
175 |
|
176 |
with gr.Accordion("Advanced Settings", open=False):
|
177 |
-
negative_prompt = gr.Textbox(label="Negative Prompt")
|
178 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
179 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
180 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=64, value=1024)
|
@@ -182,12 +200,12 @@ with gr.Blocks(css=css) as demo:
|
|
182 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=10.0, step=0.1, value=5.0)
|
183 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=28)
|
184 |
|
185 |
-
generate_btn = gr.Button("Generate Image")
|
186 |
|
187 |
-
with gr.Column():
|
188 |
-
output_image = gr.Image(label="Generated Image")
|
189 |
-
final_prompt = gr.Textbox(label="Final Prompt Used")
|
190 |
-
used_seed = gr.Number(label="Seed Used")
|
191 |
|
192 |
generate_btn.click(
|
193 |
fn=process_workflow,
|
|
|
125 |
background-color: #f0f4f8;
|
126 |
}
|
127 |
.container {
|
128 |
+
max-width: 1200px;
|
129 |
margin: 0 auto;
|
130 |
padding: 20px;
|
131 |
background-color: white;
|
|
|
141 |
border: 1px solid #bdc3c7;
|
142 |
border-radius: 5px;
|
143 |
padding: 10px;
|
144 |
+
margin-bottom: 10px;
|
145 |
}
|
146 |
.input-box:focus, .output-box:focus {
|
147 |
border-color: #3498db;
|
|
|
159 |
.submit-btn:hover {
|
160 |
background-color: #3498db;
|
161 |
}
|
162 |
+
.gr-form {
|
163 |
+
border: 1px solid #e0e0e0;
|
164 |
+
border-radius: 10px;
|
165 |
+
padding: 20px;
|
166 |
+
margin-bottom: 20px;
|
167 |
+
background-color: #f9f9f9;
|
168 |
+
}
|
169 |
+
.gr-box {
|
170 |
+
border: 1px solid #e0e0e0;
|
171 |
+
border-radius: 10px;
|
172 |
+
padding: 20px;
|
173 |
+
margin-bottom: 20px;
|
174 |
+
background-color: #ffffff;
|
175 |
+
}
|
176 |
"""
|
177 |
|
178 |
|
179 |
# Gradio Interface
|
180 |
with gr.Blocks(css=css) as demo:
|
181 |
+
gr.Markdown("# VLM Captioner + Prompt Enhancer + SD3 Image Generator")
|
182 |
|
183 |
with gr.Row():
|
184 |
+
with gr.Column(scale=1):
|
185 |
+
with gr.Box():
|
186 |
+
input_image = gr.Image(label="Input Image for VLM", elem_classes="input-box")
|
187 |
+
use_vlm = gr.Checkbox(label="Use VLM Captioner", value=False)
|
188 |
+
|
189 |
+
with gr.Box():
|
190 |
+
text_prompt = gr.Textbox(label="Text Prompt", elem_classes="input-box")
|
191 |
+
use_enhancer = gr.Checkbox(label="Use Prompt Enhancer", value=False)
|
192 |
+
model_choice = gr.Radio(["Medium", "Long"], label="Enhancer Model", value="Long")
|
193 |
|
194 |
with gr.Accordion("Advanced Settings", open=False):
|
195 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", elem_classes="input-box")
|
196 |
seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
|
197 |
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
198 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=64, value=1024)
|
|
|
200 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=0.0, maximum=10.0, step=0.1, value=5.0)
|
201 |
num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=28)
|
202 |
|
203 |
+
generate_btn = gr.Button("Generate Image", elem_classes="submit-btn")
|
204 |
|
205 |
+
with gr.Column(scale=1):
|
206 |
+
output_image = gr.Image(label="Generated Image", elem_classes="output-box")
|
207 |
+
final_prompt = gr.Textbox(label="Final Prompt Used", elem_classes="output-box")
|
208 |
+
used_seed = gr.Number(label="Seed Used", elem_classes="output-box")
|
209 |
|
210 |
generate_btn.click(
|
211 |
fn=process_workflow,
|