Update app.py
Browse files
app.py
CHANGED
@@ -196,6 +196,7 @@ def update_content(section):
|
|
196 |
|
197 |
# Define the Gradio interface with a sidebar for navigation
|
198 |
with gr.Blocks(theme=MPGPoster()) as demo:
|
|
|
199 |
with gr.Row():
|
200 |
with gr.Column(scale=1):
|
201 |
gr.Markdown("## Navigation")
|
@@ -203,11 +204,13 @@ with gr.Blocks(theme=MPGPoster()) as demo:
|
|
203 |
section_buttons = [gr.Button(value=section) for section in sections]
|
204 |
|
205 |
for button, section in zip(section_buttons, sections):
|
206 |
-
button.click(fn=update_content, inputs=
|
|
|
|
|
207 |
|
208 |
with gr.Column(scale=4):
|
209 |
content
|
210 |
-
|
211 |
with gr.Row():
|
212 |
iface = gr.Interface(
|
213 |
fn=all,
|
|
|
196 |
|
197 |
# Define the Gradio interface with a sidebar for navigation
|
198 |
with gr.Blocks(theme=MPGPoster()) as demo:
|
199 |
+
state = gr.State(value="Introduction")
|
200 |
with gr.Row():
|
201 |
with gr.Column(scale=1):
|
202 |
gr.Markdown("## Navigation")
|
|
|
204 |
section_buttons = [gr.Button(value=section) for section in sections]
|
205 |
|
206 |
for button, section in zip(section_buttons, sections):
|
207 |
+
button.click(fn=update_content, inputs=state, outputs=content).then(
|
208 |
+
fn=lambda x: section, inputs=None, outputs=state
|
209 |
+
)
|
210 |
|
211 |
with gr.Column(scale=4):
|
212 |
content
|
213 |
+
|
214 |
with gr.Row():
|
215 |
iface = gr.Interface(
|
216 |
fn=all,
|