Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,9 @@ from random import randint
|
|
| 4 |
from all_models import models
|
| 5 |
from datetime import datetime
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
now2 = 0
|
| 8 |
nb_models=24
|
| 9 |
|
|
@@ -145,6 +148,12 @@ def gen_fn(model_str, prompt):
|
|
| 145 |
|
| 146 |
return m
|
| 147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
def make_me():
|
| 149 |
# with gr.Tab('The Dream'):
|
| 150 |
with gr.Row():
|
|
@@ -173,11 +182,16 @@ def make_me():
|
|
| 173 |
for m, o in zip(current_models, output):
|
| 174 |
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
| 175 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
|
|
|
| 176 |
"""with gr.Accordion('Model selection'):
|
| 177 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
| 178 |
model_choice.change(update_imgbox, (gen_button,stop_button,group_model_choice), output)
|
| 179 |
model_choice.change(extend_choices, model_choice, current_models)
|
| 180 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
with gr.Accordion("test", open=True):
|
| 183 |
"""group_model_choice = gr.Dropdown(label="test Model", show_label=False, choices=list(models_test) , allow_custom_value=True)"""
|
|
@@ -196,6 +210,7 @@ def make_me():
|
|
| 196 |
<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!
|
| 197 |
</p>
|
| 198 |
""")
|
|
|
|
| 199 |
|
| 200 |
|
| 201 |
js_code = """
|
|
|
|
| 4 |
from all_models import models
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
+
from threading import RLock
|
| 8 |
+
lock = RLock()
|
| 9 |
+
|
| 10 |
now2 = 0
|
| 11 |
nb_models=24
|
| 12 |
|
|
|
|
| 148 |
|
| 149 |
return m
|
| 150 |
|
| 151 |
+
def add_gallery(image, model_str, gallery):
|
| 152 |
+
if gallery is None: gallery = []
|
| 153 |
+
with lock:
|
| 154 |
+
if image is not None: gallery.insert(0, (image, model_str))
|
| 155 |
+
return gallery
|
| 156 |
+
|
| 157 |
def make_me():
|
| 158 |
# with gr.Tab('The Dream'):
|
| 159 |
with gr.Row():
|
|
|
|
| 182 |
for m, o in zip(current_models, output):
|
| 183 |
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
| 184 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
| 185 |
+
o.change(add_gallery, [o, m, gallery], [gallery])
|
| 186 |
"""with gr.Accordion('Model selection'):
|
| 187 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
| 188 |
model_choice.change(update_imgbox, (gen_button,stop_button,group_model_choice), output)
|
| 189 |
model_choice.change(extend_choices, model_choice, current_models)
|
| 190 |
"""
|
| 191 |
+
with gr.Row():
|
| 192 |
+
gallery = gr.Gallery(label="Output", show_download_button=True, elem_classes="gallery",
|
| 193 |
+
interactive=False, show_share_button=True, container=True, format="png",
|
| 194 |
+
preview=True, object_fit="cover", columns=2, rows=2)
|
| 195 |
|
| 196 |
with gr.Accordion("test", open=True):
|
| 197 |
"""group_model_choice = gr.Dropdown(label="test Model", show_label=False, choices=list(models_test) , allow_custom_value=True)"""
|
|
|
|
| 210 |
<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!
|
| 211 |
</p>
|
| 212 |
""")
|
| 213 |
+
|
| 214 |
|
| 215 |
|
| 216 |
js_code = """
|