gokaygokay commited on
Commit
ad4797c
1 Parent(s): dce7d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -46
app.py CHANGED
@@ -119,24 +119,7 @@ def process_workflow(image, text_prompt, use_vlm, use_enhancer, model_choice, ne
119
  return generated_image, prompt, used_seed
120
 
121
 
122
- css = """
123
- body {
124
- font-family: 'Arial', sans-serif;
125
- background-color: #f0f4f8;
126
- }
127
- .container {
128
- max-width: 1200px;
129
- margin: 0 auto;
130
- padding: 20px;
131
- background-color: white;
132
- border-radius: 10px;
133
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
134
- }
135
- h1 {
136
- color: #2c3e50;
137
- text-align: center;
138
- margin-bottom: 20px;
139
- }
140
  .input-group, .output-group {
141
  border: 1px solid #e0e0e0;
142
  border-radius: 10px;
@@ -144,49 +127,32 @@ h1 {
144
  margin-bottom: 20px;
145
  background-color: #f9f9f9;
146
  }
147
- .input-box, .output-box {
148
- border: 1px solid #bdc3c7;
149
- border-radius: 5px;
150
- padding: 10px;
151
- margin-bottom: 10px;
152
- }
153
- .input-box:focus, .output-box:focus {
154
- border-color: #3498db;
155
- box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
156
- }
157
  .submit-btn {
158
- background-color: #2980b9;
159
- color: white;
160
- border: none;
161
- padding: 10px 20px;
162
- border-radius: 5px;
163
- cursor: pointer;
164
- transition: background-color 0.3s;
165
  }
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")
187
 
188
  with gr.Accordion("Advanced Settings", open=False):
189
- negative_prompt = gr.Textbox(label="Negative Prompt", elem_classes="input-box")
190
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
191
  randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
192
  width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=64, value=1024)
@@ -198,9 +164,9 @@ with gr.Blocks(css=css) as demo:
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,
@@ -211,4 +177,4 @@ with gr.Blocks(css=css) as demo:
211
  outputs=[output_image, final_prompt, used_seed]
212
  )
213
 
214
- demo.launch()
 
119
  return generated_image, prompt, used_seed
120
 
121
 
122
+ custom_css = """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  .input-group, .output-group {
124
  border: 1px solid #e0e0e0;
125
  border-radius: 10px;
 
127
  margin-bottom: 20px;
128
  background-color: #f9f9f9;
129
  }
 
 
 
 
 
 
 
 
 
 
130
  .submit-btn {
131
+ background-color: #2980b9 !important;
132
+ color: white !important;
 
 
 
 
 
133
  }
134
  .submit-btn:hover {
135
+ background-color: #3498db !important;
136
  }
137
  """
138
 
 
 
139
  # Gradio Interface
140
+ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="gray")) as demo:
141
  gr.Markdown("# VLM Captioner + Prompt Enhancer + SD3 Image Generator")
142
 
143
  with gr.Row():
144
  with gr.Column(scale=1):
145
  with gr.Group(elem_classes="input-group"):
146
+ input_image = gr.Image(label="Input Image for VLM")
147
  use_vlm = gr.Checkbox(label="Use VLM Captioner", value=False)
148
 
149
  with gr.Group(elem_classes="input-group"):
150
+ text_prompt = gr.Textbox(label="Text Prompt")
151
  use_enhancer = gr.Checkbox(label="Use Prompt Enhancer", value=False)
152
  model_choice = gr.Radio(["Medium", "Long"], label="Enhancer Model", value="Long")
153
 
154
  with gr.Accordion("Advanced Settings", open=False):
155
+ negative_prompt = gr.Textbox(label="Negative Prompt")
156
  seed = gr.Slider(label="Seed", minimum=0, maximum=MAX_SEED, step=1, value=0)
157
  randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
158
  width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=64, value=1024)
 
164
 
165
  with gr.Column(scale=1):
166
  with gr.Group(elem_classes="output-group"):
167
+ output_image = gr.Image(label="Generated Image")
168
+ final_prompt = gr.Textbox(label="Final Prompt Used")
169
+ used_seed = gr.Number(label="Seed Used")
170
 
171
  generate_btn.click(
172
  fn=process_workflow,
 
177
  outputs=[output_image, final_prompt, used_seed]
178
  )
179
 
180
+ demo.launch(css=custom_css)