RdnUser77 commited on
Commit
5593057
1 Parent(s): 374ecac

Update app_test.py

Browse files
Files changed (1) hide show
  1. app_test.py +5 -9
app_test.py CHANGED
@@ -25,13 +25,6 @@ default_models = models[:num_models]
25
  #current_models = default_models
26
 
27
 
28
- '''
29
- def make_update(choices):
30
- global current_models
31
- current_models = [c for c in choices]
32
- current_models += (num_models - len(choices)) * ['NA']
33
- return [gr.Image(None, label = m, visible = (m != 'NA')) for m in current_models]
34
- '''
35
 
36
  def extend_choices(choices):
37
  return choices + (num_models - len(choices)) * ['NA']
@@ -39,7 +32,7 @@ def extend_choices(choices):
39
 
40
  def update_imgbox(choices):
41
  choices_plus = extend_choices(choices)
42
- return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
43
 
44
 
45
  def gen_fn(model_str, prompt):
@@ -67,7 +60,10 @@ with gr.Blocks() as demo:
67
  output = [gr.Image(label = m) for m in default_models]
68
  model_choice.change(update_imgbox, model_choice, output)
69
 
70
- gen_button.click(gen_fn2, [model_choice, txt_input], output)
 
 
 
71
 
72
  '''
73
  output = gr.Gallery()
 
25
  #current_models = default_models
26
 
27
 
 
 
 
 
 
 
 
28
 
29
  def extend_choices(choices):
30
  return choices + (num_models - len(choices)) * ['NA']
 
32
 
33
  def update_imgbox(choices):
34
  choices_plus = extend_choices(choices)
35
+ return [gr.Image(None, label = m, visible = True) for m in choices_plus]
36
 
37
 
38
  def gen_fn(model_str, prompt):
 
60
  output = [gr.Image(label = m) for m in default_models]
61
  model_choice.change(update_imgbox, model_choice, output)
62
 
63
+ for o in output:
64
+ gen_button.click(lambda t: gen_fn(o.label, t), txt_input, o)
65
+
66
+ #gen_button.click(gen_fn2, [model_choice, txt_input], output)
67
 
68
  '''
69
  output = gr.Gallery()