Fabrice-TIERCELIN commited on
Commit
3fa3761
·
verified ·
1 Parent(s): 01d02a1

Update seed

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -33,7 +33,6 @@ def check(
33
  image_guidance_scale,
34
  strength,
35
  denoising_steps,
36
- randomize_seed,
37
  seed,
38
  debug_mode,
39
  progress = gr.Progress()):
@@ -77,7 +76,6 @@ def uncrop(
77
  image_guidance_scale,
78
  strength,
79
  denoising_steps,
80
- randomize_seed,
81
  seed,
82
  debug_mode,
83
  progress = gr.Progress()):
@@ -95,7 +93,6 @@ def uncrop(
95
  image_guidance_scale,
96
  strength,
97
  denoising_steps,
98
- randomize_seed,
99
  seed,
100
  debug_mode
101
  )
@@ -135,7 +132,7 @@ def uncrop(
135
  if denoising_steps is None:
136
  denoising_steps = 1000
137
 
138
- if randomize_seed:
139
  seed = random.randint(0, max_64_bit_int)
140
 
141
  random.seed(seed)
@@ -256,6 +253,11 @@ def uncrop(
256
  mask_image
257
  ]
258
 
 
 
 
 
 
259
  def toggle_debug(is_debug_mode):
260
  if is_debug_mode:
261
  return [gr.update(visible = True)] * 3
@@ -320,8 +322,8 @@ with gr.Blocks() as interface:
320
  image_guidance_scale = gr.Slider(minimum = 1, value = 1.5, step = 0.1, label = "Image Guidance Scale", info = "lower=image quality, higher=follow the image")
321
  strength = gr.Slider(value = 0.99, minimum = 0.01, maximum = 1.0, step = 0.01, label = "Strength", info = "lower=follow the original area (discouraged), higher=redraw from scratch")
322
  denoising_steps = gr.Number(minimum = 0, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result")
323
- randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed (not working, always checked)", value = True, info = "If checked, result is always different")
324
- seed = gr.Slider(minimum = 0, maximum = max_64_bit_int, step = 1, randomize = True, label = "Seed (if not randomized)")
325
  debug_mode = gr.Checkbox(label = "Debug mode", value = False, info = "Show intermediate results")
326
 
327
  with gr.Row():
@@ -356,7 +358,6 @@ with gr.Blocks() as interface:
356
  image_guidance_scale,
357
  strength,
358
  denoising_steps,
359
- randomize_seed,
360
  seed,
361
  debug_mode
362
  ], outputs = [], queue = False,
@@ -374,7 +375,6 @@ with gr.Blocks() as interface:
374
  image_guidance_scale,
375
  strength,
376
  denoising_steps,
377
- randomize_seed,
378
  seed,
379
  debug_mode
380
  ], outputs = [
@@ -419,7 +419,7 @@ with gr.Blocks() as interface:
419
  1024,
420
  1024,
421
  "A woman, black hair, nowadays, in the street, ultrarealistic, realistic, photorealistic, 8k",
422
- "Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
423
  0,
424
  50,
425
  7,
@@ -437,7 +437,7 @@ with gr.Blocks() as interface:
437
  1024,
438
  1024,
439
  "A man, jumping in the air, outside, ultrarealistic, realistic, photorealistic, 8k",
440
- "Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
441
  0,
442
  50,
443
  7,
@@ -455,7 +455,7 @@ with gr.Blocks() as interface:
455
  0,
456
  512,
457
  "An old yellow car, in a town, ultrarealistic, realistic, photorealistic, 8k",
458
- "Border, frame, painting, drawing, cartoon, scribbling, smear, noise, blur, watermark",
459
  0,
460
  50,
461
  7,
 
33
  image_guidance_scale,
34
  strength,
35
  denoising_steps,
 
36
  seed,
37
  debug_mode,
38
  progress = gr.Progress()):
 
76
  image_guidance_scale,
77
  strength,
78
  denoising_steps,
 
79
  seed,
80
  debug_mode,
81
  progress = gr.Progress()):
 
93
  image_guidance_scale,
94
  strength,
95
  denoising_steps,
 
96
  seed,
97
  debug_mode
98
  )
 
132
  if denoising_steps is None:
133
  denoising_steps = 1000
134
 
135
+ if seed is None:
136
  seed = random.randint(0, max_64_bit_int)
137
 
138
  random.seed(seed)
 
253
  mask_image
254
  ]
255
 
256
+ def update_seed(is_randomize_seed, seed):
257
+ if is_randomize_seed:
258
+ return random.randint(0, max_64_bit_int)
259
+ return seed
260
+
261
  def toggle_debug(is_debug_mode):
262
  if is_debug_mode:
263
  return [gr.update(visible = True)] * 3
 
322
  image_guidance_scale = gr.Slider(minimum = 1, value = 1.5, step = 0.1, label = "Image Guidance Scale", info = "lower=image quality, higher=follow the image")
323
  strength = gr.Slider(value = 0.99, minimum = 0.01, maximum = 1.0, step = 0.01, label = "Strength", info = "lower=follow the original area (discouraged), higher=redraw from scratch")
324
  denoising_steps = gr.Number(minimum = 0, value = 1000, step = 1, label = "Denoising", info = "lower=irrelevant result, higher=relevant result")
325
+ randomize_seed = gr.Checkbox(label = "\U0001F3B2 Randomize seed (not working, always random)", value = True, info = "If checked, result is always different")
326
+ seed = gr.Slider(minimum = 0, maximum = max_64_bit_int, step = 1, randomize = True, label = "Seed")
327
  debug_mode = gr.Checkbox(label = "Debug mode", value = False, info = "Show intermediate results")
328
 
329
  with gr.Row():
 
358
  image_guidance_scale,
359
  strength,
360
  denoising_steps,
 
361
  seed,
362
  debug_mode
363
  ], outputs = [], queue = False,
 
375
  image_guidance_scale,
376
  strength,
377
  denoising_steps,
 
378
  seed,
379
  debug_mode
380
  ], outputs = [
 
419
  1024,
420
  1024,
421
  "A woman, black hair, nowadays, in the street, ultrarealistic, realistic, photorealistic, 8k",
422
+ "Border, frame, painting, drawing, cartoon, 3d, scribbling, smear, noise, blur, watermark",
423
  0,
424
  50,
425
  7,
 
437
  1024,
438
  1024,
439
  "A man, jumping in the air, outside, ultrarealistic, realistic, photorealistic, 8k",
440
+ "Border, frame, painting, drawing, cartoon, 3d, scribbling, smear, noise, blur, watermark",
441
  0,
442
  50,
443
  7,
 
455
  0,
456
  512,
457
  "An old yellow car, in a town, ultrarealistic, realistic, photorealistic, 8k",
458
+ "Border, frame, painting, drawing, cartoon, 3d, scribbling, smear, noise, blur, watermark",
459
  0,
460
  50,
461
  7,