omarash2016 commited on
Commit
1ffe820
ยท
verified ยท
1 Parent(s): cc15b1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -14
app.py CHANGED
@@ -203,6 +203,7 @@ theme = gr.themes.Soft(
203
  block_title_text_weight="600"
204
  )
205
 
 
206
  custom_css = """
207
  .tight-header {
208
  margin-bottom: -20px !important;
@@ -212,6 +213,11 @@ custom_css = """
212
  margin-top: 0px !important;
213
  padding-top: 0px !important;
214
  }
 
 
 
 
 
215
  """
216
 
217
  with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True, css=custom_css) as demo:
@@ -271,7 +277,7 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True, css=custo
271
  )
272
 
273
  # Right Column: Resources Dashboard (Side View)
274
- with gr.Column(scale=2) as right_col:
275
  gr.Markdown("### ๐ŸŽ’ Learning Dashboard", elem_classes="tight-header")
276
 
277
  summary_box_side = gr.Markdown(value="### ๐Ÿ“ Key Takeaways\n*Ask a topic to get a cheat sheet!*", elem_classes="tight-content")
@@ -331,11 +337,7 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True, css=custo
331
 
332
  history.append({"role": "user", "content": user_message})
333
  history.append({"role": "assistant", "content": f"Thinking (using {model_id})..."})
334
-
335
- # Yield placeholders
336
- # Outputs: History, Chatbox, Side boxes, Bottom boxes, QUIZ STATE, Quiz Inputs (Side x2, Bottom x2), Quiz Texts (Side x2, Bottom x2)
337
- # We need to yield updates for EVERYTHING.
338
- # Simplified: We yield empty strings/defaults for now.
339
  yield history, "", "", "", "", [], \
340
  gr.update(), gr.update(), gr.update(), gr.update(), \
341
  gr.update(), gr.update(), gr.update(), gr.update(), \
@@ -405,14 +407,6 @@ with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True, css=custo
405
  outputs=[q1_result_bottom, q2_result_bottom]
406
  )
407
 
408
- # Output List Mapping (Order is critical for the 'respond' function)
409
- # 1. Chatbot, 2. Msg
410
- # 3. Side Summary, 4. Side Video, 5. Side Article
411
- # 6. Quiz State
412
- # 7-12. Side Quiz Components: Q1 Text, Q1 Radio, Q1 Result, Q2 Text, Q2 Radio, Q2 Result
413
- # 13. Bottom Summary, 14. Bottom Video, 15. Bottom Article
414
- # 16-21. Bottom Quiz Components: (Same order as Side)
415
-
416
  outputs_list = [
417
  chatbot, msg,
418
  summary_box_side, video_box_side, article_box_side,
 
203
  block_title_text_weight="600"
204
  )
205
 
206
+ # Custom CSS
207
  custom_css = """
208
  .tight-header {
209
  margin-bottom: -20px !important;
 
213
  margin-top: 0px !important;
214
  padding-top: 0px !important;
215
  }
216
+ .scrollable-right-col {
217
+ max-height: 680px;
218
+ overflow-y: auto !important;
219
+ padding-right: 10px;
220
+ }
221
  """
222
 
223
  with gr.Blocks(title="AI Python Tutor", theme=theme, fill_height=True, css=custom_css) as demo:
 
277
  )
278
 
279
  # Right Column: Resources Dashboard (Side View)
280
+ with gr.Column(scale=2, elem_classes="scrollable-right-col") as right_col:
281
  gr.Markdown("### ๐ŸŽ’ Learning Dashboard", elem_classes="tight-header")
282
 
283
  summary_box_side = gr.Markdown(value="### ๐Ÿ“ Key Takeaways\n*Ask a topic to get a cheat sheet!*", elem_classes="tight-content")
 
337
 
338
  history.append({"role": "user", "content": user_message})
339
  history.append({"role": "assistant", "content": f"Thinking (using {model_id})..."})
340
+
 
 
 
 
341
  yield history, "", "", "", "", [], \
342
  gr.update(), gr.update(), gr.update(), gr.update(), \
343
  gr.update(), gr.update(), gr.update(), gr.update(), \
 
407
  outputs=[q1_result_bottom, q2_result_bottom]
408
  )
409
 
 
 
 
 
 
 
 
 
410
  outputs_list = [
411
  chatbot, msg,
412
  summary_box_side, video_box_side, article_box_side,