gabboud commited on
Commit
6268e1a
·
1 Parent(s): e165b97

handle visibility of run and stop buttons simultaneously

Browse files
Files changed (1) hide show
  1. app.py +6 -15
app.py CHANGED
@@ -140,11 +140,8 @@ with gr.Blocks(title="RFD3 Test") as demo:
140
  return textbox_update, gen_directory, gen_results
141
 
142
  generation_event = run_btn.click(
143
- lambda: gr.update(visible=False),
144
- outputs=run_btn
145
- ).then(
146
- lambda: gr.update(visible=True),
147
- outputs=stop_btn
148
  ).then(
149
  generate, inputs=[config_upload, scaffold_upload, num_batches, num_designs_per_batch, extra_args, max_duration], outputs=[runtextbox, gen_directory, gen_results]
150
  ).then(
@@ -156,11 +153,8 @@ with gr.Blocks(title="RFD3 Test") as demo:
156
  inputs=gen_directory,
157
  outputs=output_file
158
  ).then(
159
- lambda: gr.update(visible=True),
160
- outputs=run_btn
161
- ).then(
162
- lambda: gr.update(visible=False),
163
- outputs=stop_btn
164
  )
165
 
166
  stop_btn.click(
@@ -168,11 +162,8 @@ with gr.Blocks(title="RFD3 Test") as demo:
168
  outputs=runtextbox,
169
  cancels=[generation_event]
170
  ).then(
171
- lambda: gr.update(visible=True),
172
- outputs=run_btn
173
- ).then(
174
- lambda: gr.update(visible=False),
175
- outputs=stop_btn
176
  )
177
 
178
 
 
140
  return textbox_update, gen_directory, gen_results
141
 
142
  generation_event = run_btn.click(
143
+ lambda: (gr.update(visible=False), gr.update(visible=True)),
144
+ outputs=[run_btn, stop_btn]
 
 
 
145
  ).then(
146
  generate, inputs=[config_upload, scaffold_upload, num_batches, num_designs_per_batch, extra_args, max_duration], outputs=[runtextbox, gen_directory, gen_results]
147
  ).then(
 
153
  inputs=gen_directory,
154
  outputs=output_file
155
  ).then(
156
+ lambda: (gr.update(visible=True), gr.update(visible=False)),
157
+ outputs=[run_btn, stop_btn]
 
 
 
158
  )
159
 
160
  stop_btn.click(
 
162
  outputs=runtextbox,
163
  cancels=[generation_event]
164
  ).then(
165
+ lambda: (gr.update(visible=True), gr.update(visible=False)),
166
+ outputs=[run_btn, stop_btn]
 
 
 
167
  )
168
 
169