Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -290,13 +290,15 @@ SliderSpace allows you to explore diffusion model knowledge's concept directions
|
|
290 |
- Ensure your prompt clearly relates to the selected concept
|
291 |
- Try multiple directions if you're not seeing the effect you want
|
292 |
"""
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
|
|
|
|
298 |
else:
|
299 |
-
return
|
300 |
|
301 |
with gr.Blocks(css=css) as demo:
|
302 |
with gr.Column(elem_id="col-container"):
|
@@ -308,15 +310,16 @@ with gr.Blocks(css=css) as demo:
|
|
308 |
""")
|
309 |
|
310 |
with gr.Row():
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
|
|
320 |
|
321 |
with gr.Row():
|
322 |
prompt = gr.Text(
|
|
|
290 |
- Ensure your prompt clearly relates to the selected concept
|
291 |
- Try multiple directions if you're not seeing the effect you want
|
292 |
"""
|
293 |
+
# Define a function to toggle instructions that correctly handles both states
|
294 |
+
def toggle_instructions(is_detailed):
|
295 |
+
# Toggle the state
|
296 |
+
is_detailed = not is_detailed
|
297 |
+
|
298 |
+
if is_detailed:
|
299 |
+
return detailed_instructions, "Show Simple Instructions", is_detailed
|
300 |
else:
|
301 |
+
return simple_instructions, "Show Detailed Instructions", is_detailed
|
302 |
|
303 |
with gr.Blocks(css=css) as demo:
|
304 |
with gr.Column(elem_id="col-container"):
|
|
|
310 |
""")
|
311 |
|
312 |
with gr.Row():
|
313 |
+
with gr.Column():
|
314 |
+
instructions_md = gr.Markdown(simple_instructions)
|
315 |
+
toggle_btn = gr.Button("Show Detailed Instructions")
|
316 |
+
|
317 |
+
# Toggle button to switch between simple and detailed instructions
|
318 |
+
toggle_btn.click(
|
319 |
+
fn=toggle_instructions,
|
320 |
+
inputs=[gr.State(False)], # Initial state is False (simple instructions)
|
321 |
+
outputs=[instructions_md, toggle_btn, gr.State()] # Return updated state
|
322 |
+
)
|
323 |
|
324 |
with gr.Row():
|
325 |
prompt = gr.Text(
|