Spaces:
Running
Running
Create retired_gradio_gen_tab.py
Browse files- retired_gradio_gen_tab.py +36 -0
retired_gradio_gen_tab.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'''
|
2 |
+
with gr.Tab('Single model'):
|
3 |
+
with gr.Column(scale=2):
|
4 |
+
model_choice2 = gr.Dropdown(models, label='Choose model', value=models[0])
|
5 |
+
with gr.Group():
|
6 |
+
txt_input2 = gr.Textbox(label='Your prompt:', value = preSetPrompt, lines=3, autofocus=1)
|
7 |
+
with gr.Accordion("Advanced", open=False, visible=True):
|
8 |
+
with gr.Row():
|
9 |
+
neg_input2 = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
10 |
+
with gr.Row():
|
11 |
+
width2 = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0)
|
12 |
+
height2 = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0)
|
13 |
+
with gr.Row():
|
14 |
+
steps2 = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)
|
15 |
+
cfg2 = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)
|
16 |
+
seed2 = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)
|
17 |
+
seed_rand2 = gr.Button("Randomize Seed", size="sm", variant="secondary")
|
18 |
+
seed_rand2.click(randomize_seed, None, [seed2], queue=False)
|
19 |
+
num_images = gr.Slider(1, max_images, value=max_images, step=1, label='Number of images')
|
20 |
+
with gr.Row():
|
21 |
+
gen_button2 = gr.Button('Let the machine halucinate', variant='primary', scale=2, elem_classes=["butt"])
|
22 |
+
with gr.Column(scale=1):
|
23 |
+
with gr.Group():
|
24 |
+
with gr.Row():
|
25 |
+
output2 = [gr.Image(label='', show_download_button=True,
|
26 |
+
interactive=False, width=112, height=112, visible=True, format="png",
|
27 |
+
show_share_button=False, show_label=False) for _ in range(max_images)]
|
28 |
+
for i, o in enumerate(output2):
|
29 |
+
img_i = gr.Number(i, visible=False)
|
30 |
+
num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o, queue=False)
|
31 |
+
gen_event2 = gr.on(triggers=[gen_button2.click, txt_input2.submit],
|
32 |
+
fn=lambda i, n, m, t1, t2, n1, n2, n3, n4, n5: gen_fn(m, t1, t2, n1, n2, n3, n4, n5) if (i < n) else None,
|
33 |
+
inputs=[img_i, num_images, model_choice2, txt_input2, neg_input2,
|
34 |
+
height2, width2, steps2, cfg2, seed2], outputs=[o],
|
35 |
+
concurrency_limit=None, queue=False)
|
36 |
+
'''
|