DigiP-AI commited on
Commit
895b026
·
verified ·
1 Parent(s): f60af0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -41
app.py CHANGED
@@ -22,10 +22,11 @@ app = FastAPI()
22
 
23
  # CSS to style the app
24
  css = """
25
- #app-container {
26
- max-width: 896px;
27
- margin-left: auto;
28
- margin-right: auto;
 
29
  }
30
  .gradio-container {background-color: MediumAquaMarine}
31
  footer{display:none !important}
@@ -198,46 +199,46 @@ examples = [
198
 
199
 
200
  with gr.Blocks(css=css, theme=theme) as app:
201
-
202
  with gr.Tab("Basic Settings"):
203
  with gr.Row():
204
- prompt = gr.Textbox(placeholder="Enter the image description...", show_label=True, label='Image Prompt ✍️', lines=3, show_copy_button = True)
205
-
206
- with gr.Row():
207
- gr.Examples(
208
- examples = examples,
209
- inputs = [prompt],
210
- )
211
- with gr.Row():
212
- task = gr.Radio(interactive=True, value="Stable Diffusion XL 1.0", show_label=True, label="Model of neural network 🧠 ", choices=['Stable Diffusion XL 1.0', 'Crystal Clear XL',
213
- 'Juggernaut XL', 'DreamShaper XL',
214
- 'SDXL Niji', 'Cinemax SDXL', 'NightVision XL'])
215
- with gr.Tab("Extended settings"):
216
- with gr.Row():
217
- negative_prompt = gr.Textbox(placeholder="Negative Prompt", show_label=True, label='Negative Prompt:', lines=3, value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry")
218
- with gr.Row():
219
- sampler = gr.Dropdown(value="DPM++ 2M Karras", show_label=True, label="Sampling Method:", choices=[
220
- "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"])
221
- with gr.Row():
222
- steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)
223
- with gr.Row():
224
- cfg_scale = gr.Slider(show_label=True, label="CFG Scale:", minimum=1, maximum=20, value=7, step=1)
225
- with gr.Row():
226
- seed = gr.Number(show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1)
227
- with gr.Row():
228
- width = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)
229
- with gr.Row():
230
- height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)
231
-
232
- with gr.Column():
233
- text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
234
- with gr.Column():
235
- image_output = gr.Image(show_download_button=True, interactive=False, label='Generated Image 🌄', show_share_button=False, format="png", type="filepath", elem_id="gallery")
236
-
237
- text_button.click(query, inputs=[prompt, negative_prompt, task, steps, sampler, cfg_scale, seed, width, height], outputs=image_output, concurrency_limit=48)
238
- clear_prompt =gr.Button("Clear 🗑️",variant="primary", elem_id="clear_button")
239
- clear_prompt.click(lambda: (None, None), None, [prompt, image_output], queue=False, show_api=False)
240
 
 
 
 
 
 
 
 
 
 
241
 
242
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
243
  if __name__ == "__main__":
 
22
 
23
  # CSS to style the app
24
  css = """
25
+ #generate {
26
+ width: 75%;
27
+ }
28
+ #image_output {
29
+ height: 100% !important;
30
  }
31
  .gradio-container {background-color: MediumAquaMarine}
32
  footer{display:none !important}
 
199
 
200
 
201
  with gr.Blocks(css=css, theme=theme) as app:
 
202
  with gr.Tab("Basic Settings"):
203
  with gr.Row():
204
+ with gr.Column(elem_id="col-container"):
205
+ prompt = gr.Textbox(placeholder="Enter the image description...", show_label=True, label='Image Prompt ✍️', lines=3, show_copy_button = True)
206
+
207
+ with gr.Row():
208
+ gr.Examples(
209
+ examples = examples,
210
+ inputs = [prompt],
211
+ )
212
+ with gr.Row():
213
+ task = gr.Radio(interactive=True, value="Stable Diffusion XL 1.0", show_label=True, label="Model of neural network 🧠 ", choices=['Stable Diffusion XL 1.0', 'Crystal Clear XL',
214
+ 'Juggernaut XL', 'DreamShaper XL',
215
+ 'SDXL Niji', 'Cinemax SDXL', 'NightVision XL'])
216
+ with gr.Tab("Extended settings"):
217
+ with gr.Row():
218
+ negative_prompt = gr.Textbox(placeholder="Negative Prompt", show_label=True, label='Negative Prompt:', lines=3, value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry")
219
+ with gr.Row():
220
+ sampler = gr.Dropdown(value="DPM++ 2M Karras", show_label=True, label="Sampling Method:", choices=[
221
+ "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"])
222
+ with gr.Row():
223
+ steps = gr.Slider(show_label=True, label="Sampling Steps:", minimum=1, maximum=50, value=35, step=1)
224
+ with gr.Row():
225
+ cfg_scale = gr.Slider(show_label=True, label="CFG Scale:", minimum=1, maximum=20, value=7, step=1)
226
+ with gr.Row():
227
+ seed = gr.Number(show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1)
228
+ with gr.Row():
229
+ width = gr.Slider(label="Width", minimum=512, maximum=2048, step=8, value=896, interactive=True,)
230
+ with gr.Row():
231
+ height = gr.Slider(label="Height", minimum=512, maximum=2048, step=8, value=1152,interactive=True,)
 
 
 
 
 
 
 
 
232
 
233
+ with gr.Column():
234
+ text_button = gr.Button("Generate image", variant="primary", interactive=True, elem_id="generate")
235
+ with gr.Column():
236
+ image_output = gr.Image(show_download_button=True, interactive=False, label='Generated Image 🌄', show_share_button=False, format="png", type="filepath", elem_id="gallery")
237
+
238
+ text_button.click(query, inputs=[prompt, negative_prompt, task, steps, sampler, cfg_scale, seed, width, height], outputs=image_output, concurrency_limit=48)
239
+ clear_prompt =gr.Button("Clear 🗑️",variant="primary", elem_id="clear_button")
240
+ clear_prompt.click(lambda: (None, None), None, [prompt, image_output], queue=False, show_api=False)
241
+
242
 
243
  app.queue(default_concurrency_limit=200, max_size=200) # <-- Sets up a queue with default parameters
244
  if __name__ == "__main__":