Yntec commited on
Commit
6f9fd0f
1 Parent(s): c84f54b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -49,11 +49,12 @@ def gen_fn(model_str, prompt):
49
  noise = str('') #str(randint(0, 99999999999))
50
  return models_load[model_str](f'{prompt} {noise}')
51
 
52
- def gen_fnseed(model_str, prompt, seed):
53
  if model_str == 'NA':
54
  return None
55
  noise = str('') #str(randint(0, 99999999999))
56
- return models_load[model_str](f'{prompt} {noise}')
 
57
 
58
  def gen_fnsix(model_str, prompt):
59
  if model_str == 'NA':
@@ -105,7 +106,7 @@ with gr.Blocks() as demo:
105
  with gr.Tab('Seed it!'):
106
  model_choiceseed = gr.Dropdown(models, label = f'Choose a model from the {len(models)} available! Try clearing the box and typing on it to filter them!', value = models[0], filterable = True)
107
  txt_inputseed = gr.Textbox(label = 'Your prompt:')
108
- seed = gr.Slider(label="Use a seed to replicate the same image later", info="Max 3999999999", minimum=0, maximum=MAX_SEED, step=1, value=1)
109
 
110
  max_imagesseed = 1
111
  num_imagesseed = gr.Slider(1, max_imagesone, value = max_imagesone, step = 1, label = 'One, because more would make it produce identical images with the seed', visible = False)
@@ -120,11 +121,11 @@ with gr.Blocks() as demo:
120
  for i, o in enumerate(outputseed):
121
  img_is = gr.Number(i, visible = False)
122
  num_imagesseed.change(lambda i, n: gr.update(visible = (i < n)), [img_is, num_imagesseed], o, show_progress = False)
123
- gen_eventseed = gen_buttonseed.click(lambda i, n, m, t, n1: gen_fnseed(m, t, n1) if (i < n) else None, [img_is, num_imagesseed, model_choiceseed, txt_inputseed, seed], o, concurrency_limit=None, queue=False)
124
 
125
  gen_eventseed = gr.on(triggers=[gen_buttonseed.click, txt_inputseed.submit],
126
  fn=lambda i, n, m, t, n1: gen_fnseed(m, t, n1) if (i < n) else None,
127
- inputs=[img_is, num_imagesseed, model_choiceseed, txt_inputseed, seed], outputs=[o],
128
  concurrency_limit=None, queue=False) # Be sure to delete ", queue=False" when activating the stop button
129
 
130
  #stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
 
49
  noise = str('') #str(randint(0, 99999999999))
50
  return models_load[model_str](f'{prompt} {noise}')
51
 
52
+ def gen_fnseed(model_str, prompt, useseed):
53
  if model_str == 'NA':
54
  return None
55
  noise = str('') #str(randint(0, 99999999999))
56
+ seed=useseed
57
+ return models_load[model_str](f'{prompt} {noise}', seed)
58
 
59
  def gen_fnsix(model_str, prompt):
60
  if model_str == 'NA':
 
106
  with gr.Tab('Seed it!'):
107
  model_choiceseed = gr.Dropdown(models, label = f'Choose a model from the {len(models)} available! Try clearing the box and typing on it to filter them!', value = models[0], filterable = True)
108
  txt_inputseed = gr.Textbox(label = 'Your prompt:')
109
+ useseed = gr.Slider(label="Use a seed to replicate the same image later", info="Max 3999999999", minimum=0, maximum=MAX_SEED, step=1, value=1)
110
 
111
  max_imagesseed = 1
112
  num_imagesseed = gr.Slider(1, max_imagesone, value = max_imagesone, step = 1, label = 'One, because more would make it produce identical images with the seed', visible = False)
 
121
  for i, o in enumerate(outputseed):
122
  img_is = gr.Number(i, visible = False)
123
  num_imagesseed.change(lambda i, n: gr.update(visible = (i < n)), [img_is, num_imagesseed], o, show_progress = False)
124
+ #gen_eventseed = gen_buttonseed.click(lambda i, n, m, t, n1: gen_fnseed(m, t, n1) if (i < n) else None, [img_is, num_imagesseed, model_choiceseed, txt_inputseed, useseed], o, concurrency_limit=None, queue=False)
125
 
126
  gen_eventseed = gr.on(triggers=[gen_buttonseed.click, txt_inputseed.submit],
127
  fn=lambda i, n, m, t, n1: gen_fnseed(m, t, n1) if (i < n) else None,
128
+ inputs=[img_is, num_imagesseed, model_choiceseed, txt_inputseed, useseed], outputs=[o],
129
  concurrency_limit=None, queue=False) # Be sure to delete ", queue=False" when activating the stop button
130
 
131
  #stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])