Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
from random import randint
|
3 |
from all_models import models
|
@@ -44,38 +45,33 @@ def gen_fn(model_str, prompt):
|
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
with gr.Tab('The Dream'):
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
max_images = 6
|
52 |
-
|
53 |
-
gen_button2 = gr.Button('Generate up to 6 images in up to 3 minutes total')
|
54 |
-
stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)
|
55 |
-
gen_button2.click(lambda s: gr.update(interactive = True), None, stop_button2)
|
56 |
-
|
57 |
gr.HTML(
|
58 |
"""
|
59 |
<div style="text-align: center; max-width: 1200px; margin: 0 auto;">
|
60 |
<div>
|
61 |
<body>
|
62 |
-
<div class="center"><p style="margin-bottom: 10px; color: #000000;">Scroll down to see more images.</p>
|
63 |
</div>
|
64 |
</body>
|
65 |
</div>
|
66 |
</div>
|
67 |
"""
|
68 |
)
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
79 |
with gr.Row():
|
80 |
gr.HTML(
|
81 |
"""
|
|
|
1 |
+
3.08 kB
|
2 |
import gradio as gr
|
3 |
from random import randint
|
4 |
from all_models import models
|
|
|
45 |
|
46 |
with gr.Blocks() as demo:
|
47 |
with gr.Tab('The Dream'):
|
48 |
+
txt_input = gr.Textbox(label = 'Your prompt:', lines=4).style(container=False,min_width=1200)
|
49 |
+
gen_button = gr.Button('Generate up to 6 images in up to 3 minutes total')
|
50 |
+
stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
|
51 |
+
gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
gr.HTML(
|
53 |
"""
|
54 |
<div style="text-align: center; max-width: 1200px; margin: 0 auto;">
|
55 |
<div>
|
56 |
<body>
|
57 |
+
<div class="center"><p style="margin-bottom: 10px; color: #000000;">Scroll down to see more images and select models.</p>
|
58 |
</div>
|
59 |
</body>
|
60 |
</div>
|
61 |
</div>
|
62 |
"""
|
63 |
)
|
64 |
+
with gr.Row():
|
65 |
+
output = [gr.Image(label = m, min_width=480) for m in default_models]
|
66 |
+
current_models = [gr.Textbox(m, visible = False) for m in default_models]
|
67 |
+
|
68 |
+
for m, o in zip(current_models, output):
|
69 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
70 |
+
stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
71 |
+
with gr.Accordion('Model selection'):
|
72 |
+
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models from the 686 available!', value = default_models, multiselect = True, max_choices = num_models, interactive = True, filterable = False)
|
73 |
+
model_choice.change(update_imgbox, model_choice, output)
|
74 |
+
model_choice.change(extend_choices, model_choice, current_models)
|
75 |
with gr.Row():
|
76 |
gr.HTML(
|
77 |
"""
|