eaglelandsonce commited on
Commit
0454eec
·
verified ·
1 Parent(s): 0f8a867

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py CHANGED
@@ -456,3 +456,38 @@ Follow these conventions to keep your code clean and readable:
456
  ```python
457
  if __name__ == "__main__":
458
  main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
456
  ```python
457
  if __name__ == "__main__":
458
  main()
459
+
460
+ with gr.Tabs():
461
+ # Main lesson tabs
462
+ for lesson in lessons:
463
+ with gr.Tab(lesson["title"]):
464
+ gr.Markdown(lesson["description"])
465
+
466
+ code = gr.Code(
467
+ value=lesson["starter_code"],
468
+ language="python",
469
+ label="✏️ Edit and run your Python code here",
470
+ interactive=True,
471
+ )
472
+
473
+ with gr.Row():
474
+ run_button = gr.Button("▶️ Run code", variant="primary")
475
+ clear_button = gr.Button("🧹 Clear output")
476
+
477
+ output = gr.Textbox(
478
+ label="📤 Output (stdout and errors)",
479
+ lines=14,
480
+ show_copy_button=True,
481
+ )
482
+
483
+ # Bind buttons
484
+ run_button.click(run_python, inputs=code, outputs=output)
485
+ clear_button.click(lambda: "", outputs=output)
486
+
487
+ # References / Appendices tab
488
+ with gr.Tab("References & Appendices"):
489
+ gr.Markdown(appendix_markdown)
490
+
491
+ gr.Markdown(
492
+ """
493
+