Update file_study_guide_panel.py
Browse files- file_study_guide_panel.py +17 -2
file_study_guide_panel.py
CHANGED
|
@@ -25,7 +25,8 @@ def file_study_guide_dashboard(nickname_input):
|
|
| 25 |
]
|
| 26 |
}])
|
| 27 |
|
| 28 |
-
|
|
|
|
| 29 |
|
| 30 |
def generate_study_guide(file):
|
| 31 |
if file is None:
|
|
@@ -114,6 +115,20 @@ Text:
|
|
| 114 |
guides = fetch_study_guides(user)
|
| 115 |
return [f"{g.filename} ({g.timestamp})" for g in guides]
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
def show_saved_guide(user, label):
|
| 118 |
guides = fetch_study_guides(user)
|
| 119 |
for g in guides:
|
|
@@ -127,4 +142,4 @@ Text:
|
|
| 127 |
nickname_input.change(fn=load_user_guides, inputs=[nickname_input], outputs=[guide_dropdown])
|
| 128 |
guide_dropdown.change(fn=show_saved_guide, inputs=[nickname_input, guide_dropdown], outputs=[])
|
| 129 |
|
| 130 |
-
return panel
|
|
|
|
| 25 |
]
|
| 26 |
}])
|
| 27 |
|
| 28 |
+
# Move this after render_sections is defined
|
| 29 |
+
pass
|
| 30 |
|
| 31 |
def generate_study_guide(file):
|
| 32 |
if file is None:
|
|
|
|
| 115 |
guides = fetch_study_guides(user)
|
| 116 |
return [f"{g.filename} ({g.timestamp})" for g in guides]
|
| 117 |
|
| 118 |
+
# Initialize with sample content after all functions are defined
|
| 119 |
+
section_output.children = render_sections([{
|
| 120 |
+
"section_title": "Sample Section",
|
| 121 |
+
"overview": "This is a short summary of the topic.",
|
| 122 |
+
"explanation": "This is a detailed explanation to show how learning content will look.",
|
| 123 |
+
"quiz": [
|
| 124 |
+
{"question": "What is 2+2?", "options": ["1", "2", "3", "4"], "answer": "4"},
|
| 125 |
+
{"question": "Sample Q2?", "options": ["A", "B", "C", "D"], "answer": "B"},
|
| 126 |
+
{"question": "Sample Q3?", "options": ["A", "B", "C", "D"], "answer": "C"},
|
| 127 |
+
{"question": "Sample Q4?", "options": ["A", "B", "C", "D"], "answer": "D"},
|
| 128 |
+
{"question": "Sample Q5?", "options": ["A", "B", "C", "D"], "answer": "A"}
|
| 129 |
+
]
|
| 130 |
+
}])
|
| 131 |
+
|
| 132 |
def show_saved_guide(user, label):
|
| 133 |
guides = fetch_study_guides(user)
|
| 134 |
for g in guides:
|
|
|
|
| 142 |
nickname_input.change(fn=load_user_guides, inputs=[nickname_input], outputs=[guide_dropdown])
|
| 143 |
guide_dropdown.change(fn=show_saved_guide, inputs=[nickname_input, guide_dropdown], outputs=[])
|
| 144 |
|
| 145 |
+
return panel
|