multimodalart HF staff commited on
Commit
9bf6989
1 Parent(s): 2f20a49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -24,6 +24,8 @@ pipe = FluxPipeline.from_pretrained(
24
 
25
  @spaces.GPU
26
  def infer(control_image, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=3.5, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
 
 
27
  pipe_prior_output = pipe_prior_redux(control_image)
28
  images = pipe(
29
  guidance_scale=guidance_scale,
@@ -31,11 +33,12 @@ def infer(control_image, seed=42, randomize_seed=False, width=1024, height=1024,
31
  generator=torch.Generator("cpu").manual_seed(seed),
32
  **pipe_prior_output,
33
  ).images[0]
34
- return images
 
35
  css="""
36
  #col-container {
37
  margin: 0 auto;
38
- max-width: 520px;
39
  }
40
  """
41
 
 
24
 
25
  @spaces.GPU
26
  def infer(control_image, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=3.5, num_inference_steps=28, progress=gr.Progress(track_tqdm=True)):
27
+ if randomize_seed:
28
+ seed = random.randint(0, MAX_SEED)
29
  pipe_prior_output = pipe_prior_redux(control_image)
30
  images = pipe(
31
  guidance_scale=guidance_scale,
 
33
  generator=torch.Generator("cpu").manual_seed(seed),
34
  **pipe_prior_output,
35
  ).images[0]
36
+ return images, seed
37
+
38
  css="""
39
  #col-container {
40
  margin: 0 auto;
41
+ max-width: 600px;
42
  }
43
  """
44