Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -109,6 +109,57 @@ load_fn(combined_models,HF_TOKEN)
|
|
109 |
|
110 |
'''
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
'''
|
113 |
with gr.Blocks(fill_width=True) as demo:
|
114 |
with gr.Row():
|
@@ -161,9 +212,7 @@ with gr.Blocks(fill_width=True) as demo:
|
|
161 |
model_choice.change(extend_choices, model_choice, current_models)
|
162 |
random_button.click(random_choices, None, model_choice)
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
demo.launch(show_api=False, max_threads=400)
|
167 |
|
168 |
|
169 |
|
|
|
109 |
|
110 |
'''
|
111 |
|
112 |
+
'''
|
113 |
+
|
114 |
+
with gr.Blocks(fill_width=True) as demo:
|
115 |
+
with gr.Tab(str(num_models) + ' Models'):
|
116 |
+
with gr.Column(scale=2):
|
117 |
+
with gr.Group():
|
118 |
+
txt_input = gr.Textbox(label='Your prompt:', value=preSetPrompt, lines=3, autofocus=1)
|
119 |
+
neg_input = gr.Textbox(label='Negative prompt:', value=negPreSetPrompt, lines=1)
|
120 |
+
with gr.Accordion("Advanced", open=False, visible=True):
|
121 |
+
with gr.Row():
|
122 |
+
width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0)
|
123 |
+
height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0)
|
124 |
+
with gr.Row():
|
125 |
+
steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0)
|
126 |
+
cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0)
|
127 |
+
seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1)
|
128 |
+
seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
|
129 |
+
seed_rand.click(randomize_seed, None, [seed], queue=False)
|
130 |
+
with gr.Row():
|
131 |
+
gen_button = gr.Button(f'Generate up to {int(num_models)} images', variant='primary', scale=3, elem_classes=["butt"])
|
132 |
+
random_button = gr.Button(f'Randomize Models', variant='secondary', scale=1)
|
133 |
+
|
134 |
+
with gr.Column(scale=1):
|
135 |
+
with gr.Group():
|
136 |
+
with gr.Row():
|
137 |
+
output = [gr.Image(label=m, show_download_button=True, elem_classes=["image-monitor"],
|
138 |
+
interactive=False, width=112, height=112, show_share_button=False, format="png",
|
139 |
+
visible=True) for m in default_models]
|
140 |
+
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
141 |
+
|
142 |
+
with gr.Column(scale=2):
|
143 |
+
gallery = gr.Gallery(label="Output", show_download_button=True,
|
144 |
+
interactive=False, show_share_button=False, container=True, format="png",
|
145 |
+
preview=True, object_fit="cover", columns=2, rows=2)
|
146 |
+
|
147 |
+
for m, o in zip(current_models, output):
|
148 |
+
gen_event = gr.on(triggers=[gen_button.click, txt_input.submit], fn=gen_fn,
|
149 |
+
inputs=[m, txt_input, neg_input, height, width, steps, cfg, seed], outputs=[o],
|
150 |
+
concurrency_limit=None, queue=False)
|
151 |
+
o.change(add_gallery, [o, m, gallery], [gallery])
|
152 |
+
|
153 |
+
with gr.Column(scale=4):
|
154 |
+
with gr.Accordion('Model selection'):
|
155 |
+
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {int(num_models)} different models from the {len(models)} available!', value=default_models, interactive=True)
|
156 |
+
model_choice.change(update_imgbox, model_choice, output)
|
157 |
+
model_choice.change(extend_choices, model_choice, current_models)
|
158 |
+
random_button.click(random_choices, None, model_choice)
|
159 |
+
|
160 |
+
demo.launch(show_api=False, max_threads=400)
|
161 |
+
|
162 |
+
|
163 |
'''
|
164 |
with gr.Blocks(fill_width=True) as demo:
|
165 |
with gr.Row():
|
|
|
212 |
model_choice.change(extend_choices, model_choice, current_models)
|
213 |
random_button.click(random_choices, None, model_choice)
|
214 |
|
215 |
+
'''
|
|
|
|
|
216 |
|
217 |
|
218 |
|