Pedro Cuenca commited on
Commit
6cad18a
·
1 Parent(s): 039fd33

Initialize seeds to prevent crashing.

Browse files

If the user selects one of the (empty) image cells on startup, then runs
a query, the seed would be empty before this change, and the app
crashed.

Ideally, we should disable the radio buttons until they have some
content, but I'm lazy right now.

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -12,7 +12,7 @@ SELECT_LABEL = "Select as seed"
12
  with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
13
  state = gr.Variable({
14
  'selected': -1,
15
- 'seeds': []
16
  })
17
 
18
  def infer_seeded_image(prompt, seed):
 
12
  with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
13
  state = gr.Variable({
14
  'selected': -1,
15
+ 'seeds': [random.randint(0, 2 ** 32 - 1) for _ in range(6)]
16
  })
17
 
18
  def infer_seeded_image(prompt, seed):