Yntec commited on
Commit
8bc1820
1 Parent(s): 9ac2e52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -42
app.py CHANGED
@@ -62,15 +62,6 @@ async def infer(model_str, prompt, timeout):
62
  return image
63
  return None
64
 
65
- with gr.Blocks() as demo:
66
- gr.HTML(
67
- """
68
- <div>
69
- <p> <center>For simultaneous generations without hidden queue check out <a href="https://huggingface.co/spaces/Yntec/ToyWorld">Toy World</a>! For more options like single model x6 check out <a href="https://huggingface.co/spaces/John6666/Diffusion80XX4sg">Diffusion80XX4sg</a> by John6666!</center>
70
- </p></div>
71
- """
72
- )
73
-
74
  def gen_fn(model_str, prompt):
75
  if model_str == 'NA':
76
  return None
@@ -118,7 +109,14 @@ CSS="""
118
  """
119
 
120
  with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
121
- with gr.Tab('The Dream'):
 
 
 
 
 
 
 
122
  with gr.Column(scale=2):
123
  txt_input = gr.Textbox(label='Your prompt:', lines=4)
124
  with gr.Row():
@@ -154,38 +152,6 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
154
  #model_choice.change(update_imgbox_gallery, model_choice, output)
155
  model_choice.change(extend_choices, model_choice, current_models)
156
 
157
- with gr.Tab('Single model'):
158
- with gr.Column(scale=2):
159
- model_choice2 = gr.Dropdown(models, label='Choose model', value=models[0])
160
- txt_input2 = gr.Textbox(label='Your prompt:', lines=4)
161
-
162
- max_images = 6
163
- num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
164
-
165
- with gr.Row():
166
- gen_button2 = gr.Button('Generate', scale=2)
167
- stop_button2 = gr.Button('Stop', variant='secondary', interactive=False, scale=1)
168
- gen_button2.click(lambda: gr.update(interactive = True), None, stop_button2)
169
-
170
- with gr.Column(scale=1):
171
- with gr.Group():
172
- with gr.Row():
173
- output2 = [gr.Image(label = '', show_download_button=True, elem_classes="output", interactive=False, min_width=80, visible=True, show_share_button=False, show_label=False) for _ in range(max_images)]
174
- #output2 = [gr.Image(label = '') for _ in range(max_images)]
175
-
176
- with gr.Column(scale=2):
177
- gallery2 = gr.Gallery(label="Output", show_download_button=True, elem_classes="gallery",
178
- interactive=False, show_share_button=True, container=True, format="png",
179
- preview=True, object_fit="cover", columns=2, rows=2)
180
-
181
- for i, o in enumerate(output2):
182
- img_i = gr.Number(i, visible = False)
183
- num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o)
184
- #gen_event2 = gen_button2.click(lambda i, n, m, t: gen_fn(m, t) if (i < n) else None, [img_i, num_images, model_choice2, txt_input2], o)
185
- gen_event2 = gr.on(triggers=[gen_button2.click, txt_input2.submit], fn=lambda i, n, m, t: gen_fn(m, t) if (i < n) else None, inputs=[img_i, num_images, model_choice2, txt_input2], outputs=[o])
186
- o.change(add_gallery, [o, model_choice2, gallery2], [gallery2])
187
- stop_button2.click(lambda: gr.update(interactive = False), None, stop_button2, cancels = [gen_event2])
188
-
189
  gr.Markdown("Based on the [TestGen](https://huggingface.co/spaces/derwahnsinn/TestGen) Space by derwahnsinn, the [SpacIO](https://huggingface.co/spaces/RdnUser77/SpacIO_v1) Space by RdnUser77 and Omnibus's Maximum Multiplier!")
190
 
191
  demo.queue()
 
62
  return image
63
  return None
64
 
 
 
 
 
 
 
 
 
 
65
  def gen_fn(model_str, prompt):
66
  if model_str == 'NA':
67
  return None
 
109
  """
110
 
111
  with gr.Blocks(theme='Nymbo/Nymbo_Theme', fill_width=True, css=CSS) as demo:
112
+ gr.HTML(
113
+ """
114
+ <div>
115
+ <p> <center>For simultaneous generations without hidden queue check out <a href="https://huggingface.co/spaces/Yntec/ToyWorld">Toy World</a>! For more options like single model x6 check out <a href="https://huggingface.co/spaces/John6666/Diffusion80XX4sg">Diffusion80XX4sg</a> by John6666!</center>
116
+ </p></div>
117
+ """
118
+ )
119
+ with gr.Tab('Huggingface Diffusion'):
120
  with gr.Column(scale=2):
121
  txt_input = gr.Textbox(label='Your prompt:', lines=4)
122
  with gr.Row():
 
152
  #model_choice.change(update_imgbox_gallery, model_choice, output)
153
  model_choice.change(extend_choices, model_choice, current_models)
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  gr.Markdown("Based on the [TestGen](https://huggingface.co/spaces/derwahnsinn/TestGen) Space by derwahnsinn, the [SpacIO](https://huggingface.co/spaces/RdnUser77/SpacIO_v1) Space by RdnUser77 and Omnibus's Maximum Multiplier!")
156
 
157
  demo.queue()