Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -115,57 +115,47 @@ def gen_fn_gallery(model_str, prompt, gallery):
|
|
115 |
CSS="""
|
116 |
.output { width=120px; height=120px; !important; }
|
117 |
.gallery { width=100%; height=512px; max_height=512px !important; }
|
|
|
118 |
"""
|
119 |
|
120 |
with gr.Blocks(fill_width=True, css=CSS) as demo:
|
121 |
-
with gr.Tab('The Dream'):
|
122 |
-
|
123 |
-
|
124 |
-
gen_button = gr.Button('Generate up to 6 images in up to 3 minutes total', scale=2)
|
125 |
-
stop_button = gr.Button('Stop', variant = 'secondary', interactive = False, scale=1)
|
126 |
-
gen_button.click(lambda: gr.update(interactive = True), None, stop_button)
|
127 |
-
gr.HTML(
|
128 |
-
"""
|
129 |
-
<div style="text-align: center; max-width: 1200px; margin: 0 auto;">
|
130 |
-
<div>
|
131 |
-
<body>
|
132 |
-
<div class="center"><p style="margin-bottom: 10px; color: #000000;">Scroll down to see more images and select models.</p>
|
133 |
-
</div>
|
134 |
-
</body>
|
135 |
-
</div>
|
136 |
-
</div>
|
137 |
-
"""
|
138 |
-
)
|
139 |
-
with gr.Group():
|
140 |
with gr.Row():
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
for m, o in zip(current_models, output):
|
150 |
#gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
151 |
#gen_event = gen_button.click(gen_fn_gallery, [m, txt_input, o], o)
|
152 |
-
gen_event = gen_button.click(gen_fn, [m, txt_input], [o])
|
|
|
153 |
o.change(add_gallery, [o, m, gallery], [gallery])
|
154 |
stop_button.click(lambda: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
155 |
|
156 |
-
with gr.
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
"""
|
164 |
-
<div class="footer">
|
165 |
-
<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 and Omnibus's Maximum Multiplier!
|
166 |
-
</p>
|
167 |
-
"""
|
168 |
-
)
|
169 |
|
170 |
demo.queue()
|
171 |
demo.launch()
|
|
|
115 |
CSS="""
|
116 |
.output { width=120px; height=120px; !important; }
|
117 |
.gallery { width=100%; height=512px; max_height=512px !important; }
|
118 |
+
.guide { text-align: center; max-width: 1200px; margin: 0 auto; !important; }
|
119 |
"""
|
120 |
|
121 |
with gr.Blocks(fill_width=True, css=CSS) as demo:
|
122 |
+
with gr.Tab('The Dream'):
|
123 |
+
with gr.Column(scale=2):
|
124 |
+
txt_input = gr.Textbox(label='Your prompt:', lines=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
with gr.Row():
|
126 |
+
gen_button = gr.Button('Generate up to 6 images in up to 3 minutes total', scale=2)
|
127 |
+
stop_button = gr.Button('Stop', variant='secondary', interactive=False, scale=1)
|
128 |
+
gen_button.click(lambda: gr.update(interactive = True), None, stop_button)
|
129 |
+
gr.Markdown("Scroll down to see more images and select models.", elem_classes="guide")
|
130 |
+
|
131 |
+
with gr.Column(scale=1):
|
132 |
+
with gr.Group():
|
133 |
+
with gr.Row():
|
134 |
+
output = [gr.Image(label=m, show_download_button=True, elem_classes="output", interactive=False, show_share_button=True, min_width=80, visible=True) for m in default_models]
|
135 |
+
#output = [gr.Image(label=m, show_download_button=True, elem_classes="output", interactive=False, show_share_button=True) for m in default_models]
|
136 |
+
#output = [gr.Gallery(label=m, show_download_button=True, elem_classes="output", interactive=False, show_share_button=True, container=True, format="png", object_fit="cover") for m in default_models]
|
137 |
+
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
138 |
+
|
139 |
+
with gr.Column(scale=2):
|
140 |
+
gallery = gr.Gallery(label="Output", show_download_button=True, elem_classes="gallery",
|
141 |
+
interactive=False, show_share_button=True, container=True, format="png",
|
142 |
+
object_fit="cover", columns=2) # , height=768
|
143 |
+
|
144 |
for m, o in zip(current_models, output):
|
145 |
#gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
146 |
#gen_event = gen_button.click(gen_fn_gallery, [m, txt_input, o], o)
|
147 |
+
#gen_event = gen_button.click(gen_fn, [m, txt_input], [o])
|
148 |
+
gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn, inputs=[m, txt_input], outputs=[o])
|
149 |
o.change(add_gallery, [o, m, gallery], [gallery])
|
150 |
stop_button.click(lambda: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
151 |
|
152 |
+
with gr.Column(scale=4):
|
153 |
+
with gr.Accordion('Model selection'):
|
154 |
+
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models from the 866 available!', value=default_models, interactive=True)
|
155 |
+
model_choice.change(update_imgbox, model_choice, output)
|
156 |
+
#model_choice.change(update_imgbox_gallery, model_choice, output)
|
157 |
+
model_choice.change(extend_choices, model_choice, current_models)
|
158 |
+
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!")
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
demo.queue()
|
161 |
demo.launch()
|