Update app.py
Browse files
app.py
CHANGED
@@ -52,13 +52,30 @@ def choice_group_a(group_model_choice):
|
|
52 |
print(choice)
|
53 |
return choice
|
54 |
|
55 |
-
def choice_group_b(
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
def gen_fn(model_str, prompt):
|
64 |
if model_str == 'NA':
|
@@ -94,7 +111,7 @@ def make_me():
|
|
94 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
95 |
"""with gr.Accordion('Model selection'):
|
96 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
97 |
-
model_choice.change(update_imgbox,
|
98 |
model_choice.change(extend_choices, model_choice, current_models)
|
99 |
"""
|
100 |
"""with gr.Accordion('Group Model selection'):
|
@@ -105,6 +122,7 @@ def make_me():
|
|
105 |
"""group_model_choice.change(choice_group_a,group_model_choice,choices)
|
106 |
group_model_choice.change(update_imgbox,choices,output)
|
107 |
group_model_choice.change(extend_choices,choices,current_models)"""
|
|
|
108 |
with gr.Row():
|
109 |
gr.HTML("""
|
110 |
<div class="footer">
|
|
|
52 |
print(choice)
|
53 |
return choice
|
54 |
|
55 |
+
def choice_group_b(choice):
|
56 |
+
return [gr.Image(label=m, min_width=170, height=170) for m in choice]
|
57 |
+
|
58 |
+
def choice_group_c(choice):
|
59 |
+
return [gr.Textbox(m, visible=False) for m in choice]
|
60 |
+
|
61 |
+
def choice_groupe_d(current_models,output,group_model_choice):
|
62 |
+
choice=choice_group_a(group_model_choice)
|
63 |
+
current_models=choice_group_c(choice)
|
64 |
+
output=choice_group_b(choice)
|
65 |
+
for m, o in zip(current_models, output):
|
66 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
67 |
+
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
68 |
+
return (current_models,output)
|
69 |
+
|
70 |
+
def def_test(var_Test):
|
71 |
+
(gen_button,stop_button,group_model_choice)=var_Test
|
72 |
+
choice=choice_group_a(group_model_choice)
|
73 |
+
current_models=choice_group_c(choice)
|
74 |
+
output=choice_group_b(choice)
|
75 |
+
for m, o in zip(current_models, output):
|
76 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
77 |
+
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
78 |
+
return (current_models,output)
|
79 |
|
80 |
def gen_fn(model_str, prompt):
|
81 |
if model_str == 'NA':
|
|
|
111 |
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
112 |
"""with gr.Accordion('Model selection'):
|
113 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
114 |
+
model_choice.change(update_imgbox, (gen_button,stop_button,group_model_choice), output)
|
115 |
model_choice.change(extend_choices, model_choice, current_models)
|
116 |
"""
|
117 |
"""with gr.Accordion('Group Model selection'):
|
|
|
122 |
"""group_model_choice.change(choice_group_a,group_model_choice,choices)
|
123 |
group_model_choice.change(update_imgbox,choices,output)
|
124 |
group_model_choice.change(extend_choices,choices,current_models)"""
|
125 |
+
group_model_choice.change(def_test,(gen_button,stop_button,group_model_choice),(current_models,output))
|
126 |
with gr.Row():
|
127 |
gr.HTML("""
|
128 |
<div class="footer">
|