Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -329,21 +329,26 @@ with gr.Blocks() as iface:
|
|
329 |
terminal_input = gr.Textbox(label="Enter Command")
|
330 |
terminal_button = gr.Button("Run")
|
331 |
|
332 |
-
# Function to update visibility based on current step
|
333 |
-
def update_visibility(step):
|
334 |
-
return {
|
335 |
-
step1: gr.update(visible=(step == 1)),
|
336 |
-
step2: gr.update(visible=(step == 2)),
|
337 |
-
step3: gr.update(visible=(step == 3)),
|
338 |
-
step4: gr.update(visible=(step == 4)),
|
339 |
-
step5: gr.update(visible=(step == 5)),
|
340 |
-
}
|
341 |
-
|
342 |
-
# Event handlers
|
343 |
def next_step():
|
344 |
-
|
345 |
-
|
346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
def prev_step():
|
348 |
app_process.previous_step()
|
349 |
return app_process.get_current_step_info(), update_visibility(app_process.current_step)
|
|
|
329 |
terminal_input = gr.Textbox(label="Enter Command")
|
330 |
terminal_button = gr.Button("Run")
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
def next_step():
|
333 |
+
app_process.next_step()
|
334 |
+
current_step_info = app_process.get_current_step_info()
|
335 |
+
visibility_updates = update_visibility(app_process.current_step)
|
336 |
+
|
337 |
+
# Unpack the visibility updates
|
338 |
+
step1_update = visibility_updates[step1]
|
339 |
+
step2_update = visibility_updates[step2]
|
340 |
+
step3_update = visibility_updates[step3]
|
341 |
+
step4_update = visibility_updates[step4]
|
342 |
+
step5_update = visibility_updates[step5]
|
343 |
+
|
344 |
+
return [
|
345 |
+
current_step_info, # This should be a string for the Markdown component
|
346 |
+
step1_update,
|
347 |
+
step2_update,
|
348 |
+
step3_update,
|
349 |
+
step4_update,
|
350 |
+
step5_update
|
351 |
+
]
|
352 |
def prev_step():
|
353 |
app_process.previous_step()
|
354 |
return app_process.get_current_step_info(), update_visibility(app_process.current_step)
|