Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -44,34 +44,24 @@ def gen_fn(model_str, prompt):
|
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
with gr.Tab('Printing Press'):
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
current_models = [gr.Textbox(m, visible = False) for m in default_models]
|
66 |
-
|
67 |
-
for m, o in zip(current_models, output):
|
68 |
-
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
69 |
-
stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
70 |
-
with gr.Accordion('Model selection'):
|
71 |
-
#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)
|
72 |
-
gr.Dropdown(models, label = 'Choose a model from the 686 available!', value = models[0], 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 |
"""
|
|
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
with gr.Tab('Printing Press'):
|
47 |
+
model_choice2 = gr.Dropdown(models, label = 'Choose a model from the 686 available!', value = models[0], filterable = False)
|
48 |
+
txt_input2 = gr.Textbox(label = 'Your prompt:')
|
49 |
+
|
50 |
+
current_images = 1
|
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 |
+
with gr.Column():
|
57 |
+
num_images = gr.Slider(current_images, max_images, value = 1, step = 1, label = 'Number of images')
|
58 |
+
output2 = [gr.Image(label = '') for _ in range(6)]
|
59 |
+
for i, o in enumerate(output2):
|
60 |
+
num_models = num_images
|
61 |
+
img_i = gr.Number(i, visible = False)
|
62 |
+
num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o, show_progress = False)
|
63 |
+
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)
|
64 |
+
stop_button2.click(lambda s: gr.update(interactive = False), None, stop_button2, cancels = [gen_event2])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
with gr.Row():
|
66 |
gr.HTML(
|
67 |
"""
|