Spaces:
Running
Running
derwahnsinn
commited on
Commit
•
4076665
1
Parent(s):
7ea1c98
Update app.py
Browse files
app.py
CHANGED
@@ -34,11 +34,11 @@ def update_imgbox(choices):
|
|
34 |
return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
|
35 |
|
36 |
|
37 |
-
def gen_fn(model_str, prompt):
|
38 |
if model_str == 'NA':
|
39 |
return None
|
40 |
noise = str(randint(0, 99999999999))
|
41 |
-
return models_load[model_str](f'{prompt} {noise}')
|
42 |
|
43 |
|
44 |
|
@@ -48,6 +48,7 @@ with gr.Blocks() as demo:
|
|
48 |
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models', value = default_models, multiselect = True, max_choices = num_models, interactive = True, filterable = False)
|
49 |
|
50 |
txt_input = gr.Textbox(label = 'Prompt text')
|
|
|
51 |
gen_button = gr.Button('Generate')
|
52 |
stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
|
53 |
gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
|
@@ -60,7 +61,7 @@ with gr.Blocks() as demo:
|
|
60 |
model_choice.change(extend_choices, model_choice, current_models)
|
61 |
|
62 |
for m, o in zip(current_models, output):
|
63 |
-
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
64 |
stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
65 |
|
66 |
|
|
|
34 |
return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
|
35 |
|
36 |
|
37 |
+
def gen_fn(model_str, prompt, negative_prompt):
|
38 |
if model_str == 'NA':
|
39 |
return None
|
40 |
noise = str(randint(0, 99999999999))
|
41 |
+
return models_load[model_str](f'{prompt} {noise} {negative_prompt}')
|
42 |
|
43 |
|
44 |
|
|
|
48 |
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models', value = default_models, multiselect = True, max_choices = num_models, interactive = True, filterable = False)
|
49 |
|
50 |
txt_input = gr.Textbox(label = 'Prompt text')
|
51 |
+
negtxt_input = gr.Textbox(label = 'Negative Prompt text')
|
52 |
gen_button = gr.Button('Generate')
|
53 |
stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
|
54 |
gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
|
|
|
61 |
model_choice.change(extend_choices, model_choice, current_models)
|
62 |
|
63 |
for m, o in zip(current_models, output):
|
64 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input, negtxt_input], o)
|
65 |
stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
|
66 |
|
67 |
|