DigiP-AI commited on
Commit
0a68a4d
·
verified ·
1 Parent(s): 4b53234

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -42
app.py CHANGED
@@ -155,11 +155,10 @@ footer{display:none !important}
155
  }
156
  """
157
 
158
- # Build the Gradio UI with Blocks
159
- with gr.Blocks(theme=theme, css=css) as app:
160
- # Add a title to the app
161
- gr.HTML("<center><h1>🎨 Stable Diffusion 3.5 Large + 🇬🇧</h1></center>")
162
- with gr.Tab(label="Image To Prompt"):
163
  with gr.Row():
164
  with gr.Column(scale=4):
165
  input_img = gr.Image(label="Input Picture",height=320, type="filepath")
@@ -171,8 +170,8 @@ with gr.Blocks(theme=theme, css=css) as app:
171
  clear_prompt.click(lambda: (None, None), None, [input_img, output_text], queue=False, show_api=False)
172
 
173
  submit_btn.click(feifeichat, [input_img], [output_text])
174
-
175
- with gr.Tab(label="Generate Image"):
176
  with gr.Row():
177
  with gr.Column(scale=4):
178
  with gr.Row():
@@ -185,50 +184,51 @@ with gr.Tab(label="Generate Image"):
185
  with gr.Accordion("Advanced Options", open=True):
186
  with gr.Column(scale=1):
187
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="( (((hands:-1.25))), physical-defects:2, unhealthy-deformed-joints:2, unhealthy-hands:2, out of frame, (((bad face))), (bad-image-v2-39000:1.3), (((out of frame))), deformed body features, (((poor facial details))), (poorly drawn face:1.3), jpeg artifacts, (missing arms:1.1), (missing legs:1.1), (extra arms:1.2), (extra legs:1.2), [asymmetrical features], warped expressions, distorted eyes ", lines=6, elem_id="negative-prompt-text-input")
 
188
  width = gr.Slider(
189
  label="Width",
190
- minimum=512,
191
- maximum=1280,
192
- step=8,
193
- value=896,
194
- )
195
- height = gr.Slider(
196
  label="Height",
197
- minimum=512,
198
- maximum=1280,
199
- step=8,
200
- value=1152,
201
- )
202
  method = gr.Dropdown(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])
203
- steps = gr.Slider(
204
  label="Sampling steps",
205
- minimum=1,
206
- maximum=100,
207
- step=1,
208
- value=24,
209
- )
210
- cfg = gr.Slider(
211
  label="CFG Scale",
212
- minimum=3.5,
213
- maximum=7,
214
- step=0.1,
215
- value=3.5,
216
- )
217
  strength = gr.Slider(label="Strength", value=90, minimum=0, maximum=100, step=10)
218
- seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
219
-
220
-
221
  gr.Examples(
222
  examples = examples,
223
  inputs = [text_prompt],
224
  )
225
- # Bind the button to the query function with the added width and height inputs
226
- text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=img_output)
227
 
228
- with gr.Tab("ℹ️ Tips"):
229
- with gr.Row():
230
- with gr.Column():
231
- gr.Markdown(
 
 
 
232
  """
233
  <div style="max-width: 650px; margin: 2rem auto; padding: 1rem; border-radius: 10px; background-color: #f0f0f0;">
234
  <h2 style="float: left; font-size: 1.5rem; margin-bottom: 1rem;">How to Use</h2>
@@ -244,9 +244,10 @@ with gr.Tab("ℹ️ Tips"):
244
  <p style="margin-top: 1rem; font-style: italic;">*I'm still playing around to try to sort the issue, feel free to let me know if you find a fix</p>
245
  </div>
246
  """
247
- )
248
-
 
249
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
250
  if __name__ == "__main__":
251
  app.launch(show_api=False, share=False)
252
-
 
155
  }
156
  """
157
 
158
+ # Gradio Interface
159
+ with gr.Blocks(css=css, theme=theme) as app:
160
+ gr.HTML("<h1><center>Flux Stable Diffusion Lab</center></h1>")
161
+ with gr.Tab(label="Image To Stable DiffusionPrompt"):
 
162
  with gr.Row():
163
  with gr.Column(scale=4):
164
  input_img = gr.Image(label="Input Picture",height=320, type="filepath")
 
170
  clear_prompt.click(lambda: (None, None), None, [input_img, output_text], queue=False, show_api=False)
171
 
172
  submit_btn.click(feifeichat, [input_img], [output_text])
173
+
174
+ with gr.Tab(label="Generate Image"):
175
  with gr.Row():
176
  with gr.Column(scale=4):
177
  with gr.Row():
 
184
  with gr.Accordion("Advanced Options", open=True):
185
  with gr.Column(scale=1):
186
  negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="( (((hands:-1.25))), physical-defects:2, unhealthy-deformed-joints:2, unhealthy-hands:2, out of frame, (((bad face))), (bad-image-v2-39000:1.3), (((out of frame))), deformed body features, (((poor facial details))), (poorly drawn face:1.3), jpeg artifacts, (missing arms:1.1), (missing legs:1.1), (extra arms:1.2), (extra legs:1.2), [asymmetrical features], warped expressions, distorted eyes ", lines=6, elem_id="negative-prompt-text-input")
187
+
188
  width = gr.Slider(
189
  label="Width",
190
+ minimum=512,
191
+ maximum=1280,
192
+ step=8,
193
+ value=896,
194
+ )
195
+ height = gr.Slider(
196
  label="Height",
197
+ minimum=512,
198
+ maximum=1280,
199
+ step=8,
200
+ value=1152,
201
+ )
202
  method = gr.Dropdown(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ 2S a Karras", "DPM2 a Karras", "DPM2 Karras", "DPM++ SDE Karras", "DEIS", "LMS", "DPM Adaptive", "DPM++ 2M", "DPM2 Ancestral", "DPM++ S", "DPM++ SDE", "DDPM", "DPM Fast", "dpmpp_2s_ancestral", "Euler", "Euler CFG PP", "Euler a", "Euler Ancestral", "Euler+beta", "Heun", "Heun PP2", "DDIM", "LMS Karras", "PLMS", "UniPC", "UniPC BH2"])
203
+ steps = gr.Slider(
204
  label="Sampling steps",
205
+ minimum=1,
206
+ maximum=100,
207
+ step=1,
208
+ value=24,
209
+ )
210
+ cfg = gr.Slider(
211
  label="CFG Scale",
212
+ minimum=3.5,
213
+ maximum=7,
214
+ step=0.1,
215
+ value=3.5,
216
+ )
217
  strength = gr.Slider(label="Strength", value=90, minimum=0, maximum=100, step=10)
218
+ seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
219
+
 
220
  gr.Examples(
221
  examples = examples,
222
  inputs = [text_prompt],
223
  )
 
 
224
 
225
+ # Bind the button to the query function with the added width and height inputs
226
+ text_button.click(query, inputs=[text_prompt, negative_prompt, steps, cfg, method, seed, strength, width, height], outputs=img_output)
227
+
228
+ with gr.Tab("ℹ️ Tips"):
229
+ with gr.Row():
230
+ with gr.Column():
231
+ gr.Markdown(
232
  """
233
  <div style="max-width: 650px; margin: 2rem auto; padding: 1rem; border-radius: 10px; background-color: #f0f0f0;">
234
  <h2 style="float: left; font-size: 1.5rem; margin-bottom: 1rem;">How to Use</h2>
 
244
  <p style="margin-top: 1rem; font-style: italic;">*I'm still playing around to try to sort the issue, feel free to let me know if you find a fix</p>
245
  </div>
246
  """
247
+ )
248
+
249
+
250
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
251
  if __name__ == "__main__":
252
  app.launch(show_api=False, share=False)
253
+