ccm commited on
Commit
59439cc
·
1 Parent(s): f407850

Better button callbacks

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -311,12 +311,18 @@ with gradio.Blocks() as demo:
311
  with gradio.Column():
312
  img2 = gradio.Image(label="Endpoint 2")
313
 
314
- t1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
315
- d1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
316
- th1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
317
- t2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
318
- d2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
319
- th2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
 
 
 
 
 
 
320
  steps = gradio.Dropdown(interpolation_options, label="Interpolation Length", value=random.choice(interpolation_options))
321
  btn = gradio.Button("Run")
322
  img = gradio.Image(label="Transition")
 
311
  with gradio.Column():
312
  img2 = gradio.Image(label="Endpoint 2")
313
 
314
+ lattice_inputs_1 = [t1, d1, th1]
315
+ [x.change(fn=generate_unit_cell, inputs=lattice_inputs_1, outputs=[img1]) for x in lattice_inputs_1]
316
+ lattice_inputs_2 = [t2, d2, th2]
317
+ [x.change(fn=generate_unit_cell, inputs=lattice_inputs_1, outputs=[img1]) for x in lattice_inputs_2]
318
+
319
+ # t1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
320
+ # d1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
321
+ # th1.change(fn=generate_unit_cell, inputs=[t1, d1, th1], outputs=[img1])
322
+ #
323
+ # t2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
324
+ # d2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
325
+ # th2.change(fn=generate_unit_cell, inputs=[t2, d2, th2], outputs=[img2])
326
  steps = gradio.Dropdown(interpolation_options, label="Interpolation Length", value=random.choice(interpolation_options))
327
  btn = gradio.Button("Run")
328
  img = gradio.Image(label="Transition")