prithivMLmods commited on
Commit
edd8801
1 Parent(s): 9eb9ebd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +216 -73
app.py CHANGED
@@ -1,5 +1,7 @@
1
  #!/usr/bin/env python
2
-
 
 
3
  import os
4
  import random
5
  import uuid
@@ -13,10 +15,7 @@ import torch
13
  from diffusers import DiffusionPipeline
14
  from typing import Tuple
15
 
16
- #Check for the Model Base..//
17
-
18
-
19
-
20
  bad_words = json.loads(os.getenv('BAD_WORDS', "[]"))
21
  bad_words_negative = json.loads(os.getenv('BAD_WORDS_NEGATIVE', "[]"))
22
  default_negative = os.getenv("default_negative","")
@@ -30,10 +29,12 @@ def check_text(prompt, negative=""):
30
  return True
31
  return False
32
 
33
-
34
-
35
  style_list = [
36
-
 
 
 
 
37
  {
38
  "name": "2560 x 1440",
39
  "prompt": "hyper-realistic 4K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
@@ -41,46 +42,140 @@ style_list = [
41
  },
42
 
43
  {
44
- "name": "Photo",
45
- "prompt": "cinematic photo {prompt}. 35mm photograph, film, bokeh, professional, 4k, highly detailed",
46
- "negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
47
- },
 
 
 
 
 
 
 
48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  {
50
  "name": "Cinematic",
51
- "prompt": "cinematic still {prompt}. emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
52
- "negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
53
  },
54
-
55
  {
56
- "name": "Anime",
57
- "prompt": "anime artwork {prompt}. anime style, key visual, vibrant, studio anime, highly detailed",
58
- "negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
59
  },
60
  {
61
- "name": "3D Model",
62
- "prompt": "professional 3d model {prompt}. octane render, highly detailed, volumetric, dramatic lighting",
63
- "negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
64
  },
65
  {
66
- "name": "(No style)",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  "prompt": "{prompt}",
68
  "negative_prompt": "",
69
  },
70
  ]
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
 
 
73
  STYLE_NAMES = list(styles.keys())
74
- DEFAULT_STYLE_NAME = "2560 x 1440"
 
 
 
 
75
 
76
  def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
77
- p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
 
 
 
 
 
 
 
 
78
  if not negative:
79
  negative = ""
80
  return p.replace("{prompt}", positive), n + negative
81
 
82
-
83
-
84
 
85
 
86
  DESCRIPTION = """## MidJourney
@@ -89,9 +184,6 @@ Drop your best results in the community: [rb.gy/klkbs7](http://rb.gy/klkbs7), Ha
89
  """
90
 
91
 
92
-
93
-
94
-
95
  if not torch.cuda.is_available():
96
  DESCRIPTION += "\n<p>⚠️Running on CPU, This may not work on CPU.</p>"
97
 
@@ -103,40 +195,27 @@ ENABLE_CPU_OFFLOAD = os.getenv("ENABLE_CPU_OFFLOAD", "0") == "1"
103
 
104
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
105
 
106
- NUM_IMAGES_PER_PROMPT = 1
107
-
108
  if torch.cuda.is_available():
109
  pipe = DiffusionPipeline.from_pretrained(
110
- "SG161222/RealVisXL_V3.0_Turbo",
111
  torch_dtype=torch.float16,
112
  use_safetensors=True,
113
  add_watermarker=False,
114
  variant="fp16"
115
- )
116
- pipe2 = DiffusionPipeline.from_pretrained(
117
- "SG161222/RealVisXL_V2.02_Turbo",
118
- torch_dtype=torch.float16,
119
- use_safetensors=True,
120
- add_watermarker=False,
121
- variant="fp16"
122
- )
123
  if ENABLE_CPU_OFFLOAD:
124
  pipe.enable_model_cpu_offload()
125
- pipe2.enable_model_cpu_offload()
126
  else:
127
- pipe.to(device)
128
- pipe2.to(device)
129
  print("Loaded on Device!")
130
-
131
  if USE_TORCH_COMPILE:
132
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
133
- pipe2.unet = torch.compile(pipe2.unet, mode="reduce-overhead", fullgraph=True)
134
  print("Model Compiled!")
135
 
136
- def save_image(img):
137
- unique_name = str(uuid.uuid4()) + ".png"
138
- img.save(unique_name)
139
- return unique_name
140
 
141
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
142
  if randomize_seed:
@@ -149,6 +228,9 @@ def generate(
149
  negative_prompt: str = "",
150
  use_negative_prompt: bool = False,
151
  style: str = DEFAULT_STYLE_NAME,
 
 
 
152
  seed: int = 0,
153
  width: int = 1024,
154
  height: int = 1024,
@@ -160,7 +242,13 @@ def generate(
160
  if check_text(prompt, negative_prompt):
161
  raise ValueError("Prompt contains restricted words.")
162
 
163
- prompt, negative_prompt = apply_style(style, prompt, negative_prompt)
 
 
 
 
 
 
164
  seed = int(randomize_seed_fn(seed, randomize_seed))
165
  generator = torch.Generator().manual_seed(seed)
166
 
@@ -168,33 +256,52 @@ def generate(
168
  negative_prompt = "" # type: ignore
169
  negative_prompt += default_negative
170
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  options = {
172
  "prompt": prompt,
173
  "negative_prompt": negative_prompt,
174
  "width": width,
175
  "height": height,
176
  "guidance_scale": guidance_scale,
177
- "num_inference_steps": 25,
178
  "generator": generator,
179
- "num_images_per_prompt": NUM_IMAGES_PER_PROMPT,
180
  "use_resolution_binning": use_resolution_binning,
181
  "output_type": "pil",
182
  }
183
 
184
- images = pipe(**options).images + pipe2(**options).images
 
185
 
186
- image_paths = [save_image(img) for img in images]
187
- return image_paths, seed
 
 
 
 
 
 
188
 
189
  examples = [
190
- "A closeup of a cat, a window, in a rustic cabin, close up, with a shallow depth of field, with a vintage film grain, in the style of Annie Leibovitz and in the style of Wes Anderson. --ar 85:128 --v 6.0 --style raw",
191
- "Daria Morgendorffer the main character of the animated series Daria, serious expression, very excites sultry look, so hot girl, beautiful charismatic girl, so hot shot, a woman wearing eye glasses, gorgeous figure, interesting shapes, life-size figures",
192
- "Dark green large leaves of anthurium, close up, photography, aerial view, in the style of unsplash, hasselblad h6d400c --ar 85:128 --v 6.0 --style raw",
193
  "Closeup of blonde woman depth of field, bokeh, shallow focus, minimalism, fujifilm xh2s with Canon EF lens, cinematic --ar 85:128 --v 6.0 --style raw"
194
  ]
195
 
196
  css = '''
197
- .gradio-container{max-width: 700px !important}
198
  h1{text-align:center}
199
  '''
200
  with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
@@ -214,23 +321,61 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
214
  container=False,
215
  )
216
  run_button = gr.Button("Run")
217
- result = gr.Gallery(label="Result", columns=1, preview=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  with gr.Accordion("Advanced options", open=False):
219
  use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True, visible=True)
220
  negative_prompt = gr.Text(
221
  label="Negative prompt",
222
  max_lines=1,
223
  placeholder="Enter a negative prompt",
224
- value="(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck",
225
  visible=True,
226
  )
227
  with gr.Row():
228
  num_inference_steps = gr.Slider(
229
  label="Steps",
230
  minimum=10,
231
- maximum=60,
232
  step=1,
233
- value=30,
234
  )
235
  with gr.Row():
236
  num_images_per_prompt = gr.Slider(
@@ -249,6 +394,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
249
  visible=True
250
  )
251
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
 
252
  with gr.Row(visible=True):
253
  width = gr.Slider(
254
  label="Width",
@@ -264,6 +410,7 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
264
  step=8,
265
  value=1024,
266
  )
 
267
  with gr.Row():
268
  guidance_scale = gr.Slider(
269
  label="Guidance Scale",
@@ -272,20 +419,13 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
272
  step=0.1,
273
  value=6,
274
  )
275
- with gr.Row(visible=True):
276
- style_selection = gr.Radio(
277
- show_label=True,
278
- container=True,
279
- interactive=True,
280
- choices=STYLE_NAMES,
281
- value=DEFAULT_STYLE_NAME,
282
- label="Image Style",
283
- )
284
  gr.Examples(
285
  examples=examples,
286
  inputs=prompt,
287
  outputs=[result, seed],
288
  fn=generate,
 
289
  cache_examples=CACHE_EXAMPLES,
290
  )
291
 
@@ -308,6 +448,9 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
308
  negative_prompt,
309
  use_negative_prompt,
310
  style_selection,
 
 
 
311
  seed,
312
  width,
313
  height,
@@ -319,4 +462,4 @@ with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
319
  )
320
 
321
  if __name__ == "__main__":
322
- demo.queue(max_size=20).launch()
 
1
  #!/usr/bin/env python
2
+ #patch 0.04
3
+ #Func() Dalle Collage Moved Midjourney Space
4
+ #Pruned DalleCollage Space
5
  import os
6
  import random
7
  import uuid
 
15
  from diffusers import DiffusionPipeline
16
  from typing import Tuple
17
 
18
+ #BaseConditions--
 
 
 
19
  bad_words = json.loads(os.getenv('BAD_WORDS', "[]"))
20
  bad_words_negative = json.loads(os.getenv('BAD_WORDS_NEGATIVE', "[]"))
21
  default_negative = os.getenv("default_negative","")
 
29
  return True
30
  return False
31
 
 
 
32
  style_list = [
33
+ {
34
+ "name": "3840 x 2160",
35
+ "prompt": "hyper-realistic 8K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
36
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
37
+ },
38
  {
39
  "name": "2560 x 1440",
40
  "prompt": "hyper-realistic 4K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
 
42
  },
43
 
44
  {
45
+ "name": "HD+",
46
+ "prompt": "hyper-realistic 2K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
47
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
48
+ },
49
+
50
+ {
51
+ "name": "Style Zero",
52
+ "prompt": "{prompt}",
53
+ "negative_prompt": "",
54
+ },
55
+ ]
56
 
57
+ collage_style_list = [
58
+ {
59
+ "name": "Hi-Res",
60
+ "prompt": "hyper-realistic 8K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
61
+ "negative_prompt": "cartoonish, low resolution, blurry, simplistic, abstract, deformed, ugly",
62
+ },
63
+ {
64
+ "name": "B & W",
65
+ "prompt": "black and white collage of {prompt}. monochromatic, timeless, classic, dramatic contrast",
66
+ "negative_prompt": "colorful, vibrant, bright, flashy",
67
+ },
68
+ {
69
+ "name": "Polaroid",
70
+ "prompt": "collage of polaroid photos featuring {prompt}. vintage style, high contrast, nostalgic, instant film aesthetic",
71
+ "negative_prompt": "digital, modern, low quality, blurry",
72
+ },
73
+ {
74
+ "name": "Watercolor",
75
+ "prompt": "watercolor collage of {prompt}. soft edges, translucent colors, painterly effects",
76
+ "negative_prompt": "digital, sharp lines, solid colors",
77
+ },
78
  {
79
  "name": "Cinematic",
80
+ "prompt": "cinematic collage of {prompt}. film stills, movie posters, dramatic lighting",
81
+ "negative_prompt": "static, lifeless, mundane",
82
  },
 
83
  {
84
+ "name": "Nostalgic",
85
+ "prompt": "nostalgic collage of {prompt}. retro imagery, vintage objects, sentimental journey",
86
+ "negative_prompt": "contemporary, futuristic, forward-looking",
87
  },
88
  {
89
+ "name": "Vintage",
90
+ "prompt": "vintage collage of {prompt}. aged paper, sepia tones, retro imagery, antique vibes",
91
+ "negative_prompt": "modern, contemporary, futuristic, high-tech",
92
  },
93
  {
94
+ "name": "Scrapbook",
95
+ "prompt": "scrapbook style collage of {prompt}. mixed media, hand-cut elements, textures, paper, stickers, doodles",
96
+ "negative_prompt": "clean, digital, modern, low quality",
97
+ },
98
+ {
99
+ "name": "NeoNGlow",
100
+ "prompt": "neon glow collage of {prompt}. vibrant colors, glowing effects, futuristic vibes",
101
+ "negative_prompt": "dull, muted colors, vintage, retro",
102
+ },
103
+ {
104
+ "name": "Geometric",
105
+ "prompt": "geometric collage of {prompt}. abstract shapes, colorful, sharp edges, modern design, high quality",
106
+ "negative_prompt": "blurry, low quality, traditional, dull",
107
+ },
108
+ {
109
+ "name": "Thematic",
110
+ "prompt": "thematic collage of {prompt}. cohesive theme, well-organized, matching colors, creative layout",
111
+ "negative_prompt": "random, messy, unorganized, clashing colors",
112
+ },
113
+
114
+ {
115
+ "name": "No Style",
116
  "prompt": "{prompt}",
117
  "negative_prompt": "",
118
  },
119
  ]
120
 
121
+ filters = {
122
+ "Vivid": {
123
+ "prompt": "extra vivid {prompt}",
124
+ "negative_prompt": "washed out, dull"
125
+ },
126
+ "Playa": {
127
+ "prompt": "{prompt} set in a vast playa",
128
+ "negative_prompt": "forest, mountains"
129
+ },
130
+ "Desert": {
131
+ "prompt": "{prompt} set in a desert landscape",
132
+ "negative_prompt": "ocean, city"
133
+ },
134
+ "West": {
135
+ "prompt": "{prompt} with a western theme",
136
+ "negative_prompt": "eastern, modern"
137
+ },
138
+ "Blush": {
139
+ "prompt": "{prompt} with a soft blush color palette",
140
+ "negative_prompt": "harsh colors, neon"
141
+ },
142
+ "Minimalist": {
143
+ "prompt": "{prompt} with a minimalist design",
144
+ "negative_prompt": "cluttered, ornate"
145
+ },
146
+
147
+ "Zero filter": {
148
+ "prompt": "{prompt}",
149
+ "negative_prompt": ""
150
+ },
151
+
152
+
153
+ }
154
+
155
  styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
156
+ collage_styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in collage_style_list}
157
+ filter_styles = {k: (v["prompt"], v["negative_prompt"]) for k, v in filters.items()}
158
  STYLE_NAMES = list(styles.keys())
159
+ COLLAGE_STYLE_NAMES = list(collage_styles.keys())
160
+ FILTER_NAMES = list(filters.keys())
161
+ DEFAULT_STYLE_NAME = "3840 x 2160"
162
+ DEFAULT_COLLAGE_STYLE_NAME = "Hi-Res"
163
+ DEFAULT_FILTER_NAME = "Vivid"
164
 
165
  def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:
166
+ if style_name in styles:
167
+ p, n = styles.get(style_name, styles[DEFAULT_STYLE_NAME])
168
+ elif style_name in collage_styles:
169
+ p, n = collage_styles.get(style_name, collage_styles[DEFAULT_COLLAGE_STYLE_NAME])
170
+ elif style_name in filter_styles:
171
+ p, n = filter_styles.get(style_name, filter_styles[DEFAULT_FILTER_NAME])
172
+ else:
173
+ p, n = styles[DEFAULT_STYLE_NAME]
174
+
175
  if not negative:
176
  negative = ""
177
  return p.replace("{prompt}", positive), n + negative
178
 
 
 
179
 
180
 
181
  DESCRIPTION = """## MidJourney
 
184
  """
185
 
186
 
 
 
 
187
  if not torch.cuda.is_available():
188
  DESCRIPTION += "\n<p>⚠️Running on CPU, This may not work on CPU.</p>"
189
 
 
195
 
196
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
197
 
 
 
198
  if torch.cuda.is_available():
199
  pipe = DiffusionPipeline.from_pretrained(
200
+ "SG161222/RealVisXL_V4.0",
201
  torch_dtype=torch.float16,
202
  use_safetensors=True,
203
  add_watermarker=False,
204
  variant="fp16"
205
+ ).to(device)
206
+
 
 
 
 
 
 
207
  if ENABLE_CPU_OFFLOAD:
208
  pipe.enable_model_cpu_offload()
 
209
  else:
210
+ pipe.to(device)
 
211
  print("Loaded on Device!")
212
+
213
  if USE_TORCH_COMPILE:
214
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
 
215
  print("Model Compiled!")
216
 
217
+ def save_image(img, path):
218
+ img.save(path)
 
 
219
 
220
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
221
  if randomize_seed:
 
228
  negative_prompt: str = "",
229
  use_negative_prompt: bool = False,
230
  style: str = DEFAULT_STYLE_NAME,
231
+ collage_style: str = DEFAULT_COLLAGE_STYLE_NAME,
232
+ filter_name: str = DEFAULT_FILTER_NAME,
233
+ grid_size: str = "2x2",
234
  seed: int = 0,
235
  width: int = 1024,
236
  height: int = 1024,
 
242
  if check_text(prompt, negative_prompt):
243
  raise ValueError("Prompt contains restricted words.")
244
 
245
+ if collage_style != "No Style":
246
+ prompt, negative_prompt = apply_style(collage_style, prompt, negative_prompt)
247
+ elif filter_name != "No Filter":
248
+ prompt, negative_prompt = apply_style(filter_name, prompt, negative_prompt)
249
+ else:
250
+ prompt, negative_prompt = apply_style(style, prompt, negative_prompt)
251
+
252
  seed = int(randomize_seed_fn(seed, randomize_seed))
253
  generator = torch.Generator().manual_seed(seed)
254
 
 
256
  negative_prompt = "" # type: ignore
257
  negative_prompt += default_negative
258
 
259
+ grid_sizes = {
260
+ "2x1": (2, 1),
261
+ "1x2": (1, 2),
262
+ "2x2": (2, 2),
263
+ "2x3": (2, 3),
264
+ "3x2": (3, 2),
265
+ "1x1": (1, 1)
266
+ }
267
+
268
+ grid_size_x, grid_size_y = grid_sizes.get(grid_size, (2, 2))
269
+ num_images = grid_size_x * grid_size_y
270
+
271
  options = {
272
  "prompt": prompt,
273
  "negative_prompt": negative_prompt,
274
  "width": width,
275
  "height": height,
276
  "guidance_scale": guidance_scale,
277
+ "num_inference_steps": 20,
278
  "generator": generator,
279
+ "num_images_per_prompt": num_images,
280
  "use_resolution_binning": use_resolution_binning,
281
  "output_type": "pil",
282
  }
283
 
284
+ torch.cuda.empty_cache() # Clear GPU memory
285
+ images = pipe(**options).images
286
 
287
+ grid_img = Image.new('RGB', (width * grid_size_x, height * grid_size_y))
288
+
289
+ for i, img in enumerate(images[:num_images]):
290
+ grid_img.paste(img, (i % grid_size_x * width, i // grid_size_x * height))
291
+
292
+ unique_name = str(uuid.uuid4()) + ".png"
293
+ save_image(grid_img, unique_name)
294
+ return [unique_name], seed
295
 
296
  examples = [
297
+ "Portrait of a beautiful woman in a hat, summer outfit, with freckles on her face, in a close up shot, with sunlight, outdoors, in soft light, with a beach background, looking at the camera, with high resolution photography, in the style of Hasselblad X2D50c --ar 85:128 --v 6.0 --style raw",
298
+ "3d image, cute girl, in the style of Pixar --ar 1:2 --stylize 750, 4K resolution highlights, Sharp focus, octane render, ray tracing, Ultra-High-Definition, 8k, UHD, HDR, (Masterpiece:1.5), (best quality:1.5)",
299
+ "Cold coffee in a cup bokeh --ar 85:128 --v 6.0 --style raw5, 4K, Photo-Realistic",
300
  "Closeup of blonde woman depth of field, bokeh, shallow focus, minimalism, fujifilm xh2s with Canon EF lens, cinematic --ar 85:128 --v 6.0 --style raw"
301
  ]
302
 
303
  css = '''
304
+ .gradio-container{max-width: 670px !important}
305
  h1{text-align:center}
306
  '''
307
  with gr.Blocks(css=css, theme="bethecloud/storj_theme") as demo:
 
321
  container=False,
322
  )
323
  run_button = gr.Button("Run")
324
+ result = gr.Gallery(label="Grid", columns=1, preview=True)
325
+
326
+
327
+ with gr.Row(visible=True):
328
+ filter_selection = gr.Radio(
329
+ show_label=True,
330
+ container=True,
331
+ interactive=True,
332
+ choices=FILTER_NAMES,
333
+ value=DEFAULT_FILTER_NAME,
334
+ label="Filter Type",
335
+ )
336
+
337
+ with gr.Row(visible=True):
338
+ style_selection = gr.Radio(
339
+ show_label=True,
340
+ container=True,
341
+ interactive=True,
342
+ choices=STYLE_NAMES,
343
+ value=DEFAULT_STYLE_NAME,
344
+ label="Quality Style",
345
+ )
346
+
347
+ with gr.Row(visible=True):
348
+ collage_style_selection = gr.Radio(
349
+ show_label=True,
350
+ container=True,
351
+ interactive=True,
352
+ choices=COLLAGE_STYLE_NAMES,
353
+ value=DEFAULT_COLLAGE_STYLE_NAME,
354
+ label="Collage Template",
355
+ )
356
+ with gr.Row(visible=True):
357
+ grid_size_selection = gr.Dropdown(
358
+ choices=["2x1", "1x2", "2x2", "2x3", "3x2", "1x1"],
359
+ value="2x2",
360
+ label="Grid Size"
361
+ )
362
+
363
  with gr.Accordion("Advanced options", open=False):
364
  use_negative_prompt = gr.Checkbox(label="Use negative prompt", value=True, visible=True)
365
  negative_prompt = gr.Text(
366
  label="Negative prompt",
367
  max_lines=1,
368
  placeholder="Enter a negative prompt",
369
+ value="(deformed, distorted, disfigured:1.3), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers:1.4), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation",
370
  visible=True,
371
  )
372
  with gr.Row():
373
  num_inference_steps = gr.Slider(
374
  label="Steps",
375
  minimum=10,
376
+ maximum=30,
377
  step=1,
378
+ value=15,
379
  )
380
  with gr.Row():
381
  num_images_per_prompt = gr.Slider(
 
394
  visible=True
395
  )
396
  randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
397
+
398
  with gr.Row(visible=True):
399
  width = gr.Slider(
400
  label="Width",
 
410
  step=8,
411
  value=1024,
412
  )
413
+
414
  with gr.Row():
415
  guidance_scale = gr.Slider(
416
  label="Guidance Scale",
 
419
  step=0.1,
420
  value=6,
421
  )
422
+
 
 
 
 
 
 
 
 
423
  gr.Examples(
424
  examples=examples,
425
  inputs=prompt,
426
  outputs=[result, seed],
427
  fn=generate,
428
+ #cache_examples=True,
429
  cache_examples=CACHE_EXAMPLES,
430
  )
431
 
 
448
  negative_prompt,
449
  use_negative_prompt,
450
  style_selection,
451
+ collage_style_selection,
452
+ filter_selection,
453
+ grid_size_selection,
454
  seed,
455
  width,
456
  height,
 
462
  )
463
 
464
  if __name__ == "__main__":
465
+ demo.queue(max_size=20).launch()