RdnUser77 commited on
Commit
1792197
1 Parent(s): 67e979d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -50,9 +50,9 @@ with gr.Blocks() as demo:
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)
54
 
55
- with gr.Row():
56
  output = [gr.Image(label = m) for m in default_models]
57
  current_models = [gr.Textbox(m, visible = False) for m in default_models]
58
 
@@ -60,7 +60,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
 
@@ -68,22 +68,22 @@ with gr.Blocks() as demo:
68
  model_choice2 = gr.Dropdown(models, label = 'Choose model', value = models[0], filterable = False)
69
  txt_input2 = gr.Textbox(label = 'Prompt text')
70
 
71
- max_images = 6
72
  num_images = gr.Slider(1, max_images, value = max_images, step = 1, label = 'Number of images')
73
 
74
  gen_button2 = gr.Button('Generate')
75
  stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)
76
  gen_button2.click(lambda s: gr.update(interactive = True), None, stop_button2)
77
 
78
- with gr.Row():
79
  output2 = [gr.Image(label = '') for _ in range(max_images)]
80
 
81
  for i, o in enumerate(output2):
82
  img_i = gr.Number(i, visible = False)
83
  num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o, show_progress = False)
84
- gen_event2 = gen_button2.click(lambda i, n, m, t: gen_fn(m, t) if (i < n) else None, [img_i, num_images, model_choice2, txt_input2], o)
85
  stop_button2.click(lambda s: gr.update(interactive = False), None, stop_button2, cancels = [gen_event2])
86
 
87
 
88
- demo.queue(concurrency_count = 36)
89
  demo.launch()
 
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, concurrency_limit = 36)
54
 
55
+ with gr.Column():
56
  output = [gr.Image(label = m) for m in default_models]
57
  current_models = [gr.Textbox(m, visible = False) for m in default_models]
58
 
 
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, concurrency_limit = 36)
64
  stop_button.click(lambda s: gr.update(interactive = False), None, stop_button, cancels = [gen_event])
65
 
66
 
 
68
  model_choice2 = gr.Dropdown(models, label = 'Choose model', value = models[0], filterable = False)
69
  txt_input2 = gr.Textbox(label = 'Prompt text')
70
 
71
+ max_images = 4
72
  num_images = gr.Slider(1, max_images, value = max_images, step = 1, label = 'Number of images')
73
 
74
  gen_button2 = gr.Button('Generate')
75
  stop_button2 = gr.Button('Stop', variant = 'secondary', interactive = False)
76
  gen_button2.click(lambda s: gr.update(interactive = True), None, stop_button2)
77
 
78
+ with gr.Column():
79
  output2 = [gr.Image(label = '') for _ in range(max_images)]
80
 
81
  for i, o in enumerate(output2):
82
  img_i = gr.Number(i, visible = False)
83
  num_images.change(lambda i, n: gr.update(visible = (i < n)), [img_i, num_images], o, show_progress = False)
84
+ gen_event2 = gen_button2.click(lambda i, n, m, t: gen_fn(m, t) if (i < n) else None, [img_i, num_images, model_choice2, txt_input2], o, concurrency_limit = 36)
85
  stop_button2.click(lambda s: gr.update(interactive = False), None, stop_button2, cancels = [gen_event2])
86
 
87
 
88
+ demo.queue()
89
  demo.launch()