kaleidoskop-hug commited on
Commit
dab883f
1 Parent(s): 7686862

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -61
app.py CHANGED
@@ -99,6 +99,7 @@ def gen_fnsix(model_str, prompt):
99
  return None
100
  noisesix = str(randint(1941, 2023)) #str(randint(0, 99999999999))
101
  return models_load[model_str](f'{prompt} {noisesix}')
 
102
  with gr.Blocks() as demo:
103
  gr.HTML(
104
  """
@@ -114,73 +115,14 @@ with gr.Blocks() as demo:
114
  </p></div>
115
  """
116
  )
117
- with gr.Tab('One Image'):
118
- model_choice = 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)
119
- txt_input = gr.Textbox(label = 'Your prompt:')
120
-
121
- max_imagesone = 1
122
- num_imagesone = gr.Slider(1, max_imagesone, value = max_imagesone, step = 1, label = 'Nobody gets to see this label so I can put here whatever I want!', visible = False)
123
-
124
- gen_button = gr.Button('Generate')
125
- #stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
126
- gen_button.click(lambda s: gr.update(interactive = True), None)
127
-
128
- with gr.Row():
129
- output = [gr.Image(label = '') for _ in range(max_imagesone)]
130
-
131
- for i, o in enumerate(output):
132
- img_in = gr.Number(i, visible = False)
133
- num_imagesone.change(lambda i, n: gr.update(visible = (i < n)), [img_in, num_imagesone], o, show_progress = False)
134
- gen_event = gen_button.click(lambda i, n, m, t: gen_fn(m, t) if (i < n) else None, [img_in, num_imagesone, model_choice, txt_input], o, concurrency_limit=None, queue=False)
135
- #stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
136
- with gr.Row():
137
- gr.HTML(
138
- """
139
- <div class="footer">
140
- <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77, Omnibus's Maximum Multiplier, and <a href="https://huggingface.co/spaces/Yntec/ToyWorld">Toy World</a>!
141
- </p>
142
- """
143
- )
144
- with gr.Tab('Seed it!'):
145
- 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)
146
- txt_inputseed = gr.Textbox(label = 'Your prompt:')
147
- 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)
148
-
149
- max_imagesseed = 1
150
- 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)
151
-
152
- gen_buttonseed = gr.Button('Generate an image using the seed')
153
- #stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
154
- gen_button.click(lambda s: gr.update(interactive = True), None)
155
-
156
- with gr.Row():
157
- outputseed = [gr.Image(label = '') for _ in range(max_imagesseed)]
158
-
159
- for i, o in enumerate(outputseed):
160
- img_is = gr.Number(i, visible = False)
161
- num_imagesseed.change(lambda i, n: gr.update(visible = (i < n)), [img_is, num_imagesseed], o, show_progress = False)
162
- #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)
163
-
164
- gen_eventseed = gr.on(triggers=[gen_buttonseed.click, txt_inputseed.submit],
165
- fn=lambda i, n, m, t, n1: gen_fnseed(m, t, n1) if (i < n) else None,
166
- inputs=[img_is, num_imagesseed, model_choiceseed, txt_inputseed, seed], outputs=[o],
167
- concurrency_limit=None, queue=False) # Be sure to delete ", queue=False" when activating the stop button
168
-
169
- #stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
170
- with gr.Row():
171
- gr.HTML(
172
- """
173
- <div class="footer">
174
- <p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77, Omnibus's Maximum Multiplier, and <a href="https://huggingface.co/spaces/Yntec/ToyWorld">Toy World</a>!
175
- </p>
176
- """
177
- )
178
  with gr.Tab('Up To Six'):
179
  model_choice2 = 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)
180
  txt_input2 = gr.Textbox(label = 'Your prompt:')
181
 
182
  max_images = 6
183
  num_images = gr.Slider(1, max_images, value = max_images, step = 1, label = 'Number of images (if you want less than 6 decrease them slowly until they match the boxes below)')
 
 
184
 
185
  gen_button2 = gr.Button('Generate up to 6 images in up to 3 minutes total')
186
  #stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)
 
99
  return None
100
  noisesix = str(randint(1941, 2023)) #str(randint(0, 99999999999))
101
  return models_load[model_str](f'{prompt} {noisesix}')
102
+
103
  with gr.Blocks() as demo:
104
  gr.HTML(
105
  """
 
115
  </p></div>
116
  """
117
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  with gr.Tab('Up To Six'):
119
  model_choice2 = 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)
120
  txt_input2 = gr.Textbox(label = 'Your prompt:')
121
 
122
  max_images = 6
123
  num_images = gr.Slider(1, max_images, value = max_images, step = 1, label = 'Number of images (if you want less than 6 decrease them slowly until they match the boxes below)')
124
+ width_images = gr.Slider(128, 1440, value = 1024, step = 32, label = 'Image width')
125
+ height_images = gr.Slider(128, 1440, value = 1024, step = 32, label = 'Image height')
126
 
127
  gen_button2 = gr.Button('Generate up to 6 images in up to 3 minutes total')
128
  #stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)