Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -137,6 +137,13 @@ h1 {
|
|
| 137 |
text-align: center;
|
| 138 |
margin-bottom: 20px;
|
| 139 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
.input-box, .output-box {
|
| 141 |
border: 1px solid #bdc3c7;
|
| 142 |
border-radius: 5px;
|
|
@@ -159,34 +166,21 @@ h1 {
|
|
| 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.
|
| 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.
|
| 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")
|
|
@@ -203,9 +197,10 @@ with gr.Blocks(css=css) as demo:
|
|
| 203 |
generate_btn = gr.Button("Generate Image", elem_classes="submit-btn")
|
| 204 |
|
| 205 |
with gr.Column(scale=1):
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
| 209 |
|
| 210 |
generate_btn.click(
|
| 211 |
fn=process_workflow,
|
|
|
|
| 137 |
text-align: center;
|
| 138 |
margin-bottom: 20px;
|
| 139 |
}
|
| 140 |
+
.input-group, .output-group {
|
| 141 |
+
border: 1px solid #e0e0e0;
|
| 142 |
+
border-radius: 10px;
|
| 143 |
+
padding: 20px;
|
| 144 |
+
margin-bottom: 20px;
|
| 145 |
+
background-color: #f9f9f9;
|
| 146 |
+
}
|
| 147 |
.input-box, .output-box {
|
| 148 |
border: 1px solid #bdc3c7;
|
| 149 |
border-radius: 5px;
|
|
|
|
| 166 |
.submit-btn:hover {
|
| 167 |
background-color: #3498db;
|
| 168 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
"""
|
| 170 |
|
| 171 |
+
# ... (keep the helper functions as before)
|
| 172 |
+
|
| 173 |
# Gradio Interface
|
| 174 |
with gr.Blocks(css=css) as demo:
|
| 175 |
gr.Markdown("# VLM Captioner + Prompt Enhancer + SD3 Image Generator")
|
| 176 |
|
| 177 |
with gr.Row():
|
| 178 |
with gr.Column(scale=1):
|
| 179 |
+
with gr.Group(elem_classes="input-group"):
|
| 180 |
input_image = gr.Image(label="Input Image for VLM", elem_classes="input-box")
|
| 181 |
use_vlm = gr.Checkbox(label="Use VLM Captioner", value=False)
|
| 182 |
|
| 183 |
+
with gr.Group(elem_classes="input-group"):
|
| 184 |
text_prompt = gr.Textbox(label="Text Prompt", elem_classes="input-box")
|
| 185 |
use_enhancer = gr.Checkbox(label="Use Prompt Enhancer", value=False)
|
| 186 |
model_choice = gr.Radio(["Medium", "Long"], label="Enhancer Model", value="Long")
|
|
|
|
| 197 |
generate_btn = gr.Button("Generate Image", elem_classes="submit-btn")
|
| 198 |
|
| 199 |
with gr.Column(scale=1):
|
| 200 |
+
with gr.Group(elem_classes="output-group"):
|
| 201 |
+
output_image = gr.Image(label="Generated Image", elem_classes="output-box")
|
| 202 |
+
final_prompt = gr.Textbox(label="Final Prompt Used", elem_classes="output-box")
|
| 203 |
+
used_seed = gr.Number(label="Seed Used", elem_classes="output-box")
|
| 204 |
|
| 205 |
generate_btn.click(
|
| 206 |
fn=process_workflow,
|