RohitGandikota commited on
Commit
dcf8b48
·
verified ·
1 Parent(s): cdec237

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -291,11 +291,12 @@ SliderSpace allows you to explore diffusion model knowledge's concept directions
291
  - Try multiple directions if you're not seeing the effect you want
292
  """
293
 
294
- def toggle_instructions(show_detailed):
295
- if show_detailed:
296
- return gr.Markdown(detailed_instructions), gr.Button("Show Simple Instructions")
 
297
  else:
298
- return gr.Markdown(simple_instructions), gr.Button("Show Detailed Instructions")
299
 
300
  with gr.Blocks(css=css) as demo:
301
  with gr.Column(elem_id="col-container"):
@@ -313,9 +314,8 @@ with gr.Blocks(css=css) as demo:
313
  # Toggle button to switch between simple and detailed instructions
314
  toggle_btn.click(
315
  fn=toggle_instructions,
316
- inputs=[gr.State(False)],
317
- outputs=[instructions_md, toggle_btn],
318
- _js="(x) => !x" # Toggle the state
319
  )
320
 
321
  with gr.Row():
 
291
  - Try multiple directions if you're not seeing the effect you want
292
  """
293
 
294
+ # Define a function to toggle instructions
295
+ def toggle_instructions(state):
296
+ if state:
297
+ return simple_instructions, "Show Detailed Instructions", False
298
  else:
299
+ return detailed_instructions, "Show Simple Instructions", True
300
 
301
  with gr.Blocks(css=css) as demo:
302
  with gr.Column(elem_id="col-container"):
 
314
  # Toggle button to switch between simple and detailed instructions
315
  toggle_btn.click(
316
  fn=toggle_instructions,
317
+ inputs=[gr.State(False)], # Initial state is False
318
+ outputs=[instructions_md, toggle_btn, gr.State()] # Return the new state
 
319
  )
320
 
321
  with gr.Row():