Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,22 +43,23 @@ def gen_fn(model_str, prompt):
|
|
43 |
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
-
with gr.Tab('Printing Press'):
|
47 |
-
model_choice2 = gr.Dropdown(models, label = 'Choose
|
48 |
-
txt_input2 = gr.Textbox(label = '
|
49 |
|
50 |
-
max_images =
|
|
|
51 |
|
52 |
-
gen_button2 = gr.Button('Generate
|
53 |
stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)
|
54 |
gen_button2.click(lambda s: gr.update(interactive = True), None, stop_button2)
|
55 |
-
|
56 |
-
|
57 |
-
output2 = [gr.Image(label = '') for _ in range(
|
|
|
58 |
for i, o in enumerate(output2):
|
59 |
-
num_models = num_images
|
60 |
img_i = gr.Number(i, visible = False)
|
61 |
-
|
62 |
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)
|
63 |
stop_button2.click(lambda s: gr.update(interactive = False), None, stop_button2, cancels = [gen_event2])
|
64 |
with gr.Row():
|
|
|
43 |
|
44 |
|
45 |
with gr.Blocks() as demo:
|
46 |
+
with gr.Tab('Printing Press'):
|
47 |
+
model_choice2 = gr.Dropdown(models, label = 'Choose model', value = models[0], filterable = False)
|
48 |
+
txt_input2 = gr.Textbox(label = 'Prompt text')
|
49 |
|
50 |
+
max_images = 6
|
51 |
+
num_images = gr.Slider(1, max_images, value = max_images, step = 1, label = 'Number of images')
|
52 |
|
53 |
+
gen_button2 = gr.Button('Generate')
|
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 |
+
with gr.Row():
|
58 |
+
output2 = [gr.Image(label = '') for _ in range(max_images)]
|
59 |
+
|
60 |
for i, o in enumerate(output2):
|
|
|
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():
|