Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
295 |
-
|
296 |
-
|
|
|
297 |
else:
|
298 |
-
return
|
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():
|