jdesiree commited on
Commit
7f8e7b7
·
verified ·
1 Parent(s): 94c43c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -56
app.py CHANGED
@@ -515,62 +515,62 @@ def clear_chat():
515
 
516
  # --- UI: Interface Creation ---
517
  def create_interface():
518
- """Creates and configures the complete Gradio interface."""
519
-
520
- with gr.Blocks(
521
- css=custom_css,
522
- title="EduBot",
523
- fill_width=True,
524
- fill_height=True,
525
- theme=gr.themes.Base()
526
- ) as demo:
527
- # Add head content and MathJax
528
- gr.HTML(html_head_content)
529
- gr.HTML('<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>')
530
- gr.HTML(mathjax_config)
531
-
532
- # Force full height container with aggressive CSS
533
- gr.HTML('<style>.main-container { height: 100vh !important; display: flex !important; flex-direction: column !important; }</style>')
534
-
535
- with gr.Column(elem_classes=["main-container"]):
536
- # Title Section
537
- with gr.Row(height="10vh"):
538
- gr.HTML('<div class="title-header"><h1>🎓 EduBot</h1></div>')
539
-
540
- # Chat Section
541
- with gr.Row():
542
- chatbot = gr.Chatbot(
543
- type="messages",
544
- show_copy_button=True,
545
- show_share_button=False,
546
- avatar_images=None,
547
- elem_id="main-chatbot",
548
- container=False, # Remove wrapper
549
- scale=1,
550
- height="70vh" # Explicit height instead of min_height
551
- )
552
-
553
- # Input Section - fixed height
554
- with gr.Row(elem_classes=["input-controls"]):
555
- msg = gr.Textbox(
556
- placeholder="Ask me about math, research, study strategies, or any educational topic...",
557
- show_label=False,
558
- lines=4,
559
- max_lines=6,
560
- elem_classes=["input-textbox"],
561
- container=False,
562
- scale=4
563
- )
564
- with gr.Column(elem_classes=["button-column"], scale=1):
565
- send = gr.Button("Send", elem_classes=["send-button"], size="sm")
566
- clear = gr.Button("Clear", elem_classes=["clear-button"], size="sm")
567
-
568
- # Set up event handlers
569
- msg.submit(respond_and_update, [msg, chatbot], [chatbot, msg])
570
- send.click(respond_and_update, [msg, chatbot], [chatbot, msg])
571
- clear.click(clear_chat, outputs=[chatbot, msg])
572
-
573
- return demo
574
 
575
  # ===============================================================================
576
  # END UI CONFIGURATION SECTION
 
515
 
516
  # --- UI: Interface Creation ---
517
  def create_interface():
518
+ """Creates and configures the complete Gradio interface."""
519
+
520
+ with gr.Blocks(
521
+ css=custom_css,
522
+ title="EduBot",
523
+ fill_width=True,
524
+ fill_height=True,
525
+ theme=gr.themes.Base()
526
+ ) as demo:
527
+ # Add head content and MathJax
528
+ gr.HTML(html_head_content)
529
+ gr.HTML('<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>')
530
+ gr.HTML(mathjax_config)
531
+
532
+ # Force full height container with aggressive CSS
533
+ gr.HTML('<style>.main-container { height: 100vh !important; display: flex !important; flex-direction: column !important; }</style>')
534
+
535
+ with gr.Column(elem_classes=["main-container"]):
536
+ # Title Section
537
+ with gr.Row(height="10vh"):
538
+ gr.HTML('<div class="title-header"><h1>🎓 EduBot</h1></div>')
539
+
540
+ # Chat Section
541
+ with gr.Row():
542
+ chatbot = gr.Chatbot(
543
+ type="messages",
544
+ show_copy_button=True,
545
+ show_share_button=False,
546
+ avatar_images=None,
547
+ elem_id="main-chatbot",
548
+ container=False, # Remove wrapper
549
+ scale=1,
550
+ height="70vh" # Explicit height instead of min_height
551
+ )
552
+
553
+ # Input Section - fixed height
554
+ with gr.Row(elem_classes=["input-controls"]):
555
+ msg = gr.Textbox(
556
+ placeholder="Ask me about math, research, study strategies, or any educational topic...",
557
+ show_label=False,
558
+ lines=4,
559
+ max_lines=6,
560
+ elem_classes=["input-textbox"],
561
+ container=False,
562
+ scale=4
563
+ )
564
+ with gr.Column(elem_classes=["button-column"], scale=1):
565
+ send = gr.Button("Send", elem_classes=["send-button"], size="sm")
566
+ clear = gr.Button("Clear", elem_classes=["clear-button"], size="sm")
567
+
568
+ # Set up event handlers
569
+ msg.submit(respond_and_update, [msg, chatbot], [chatbot, msg])
570
+ send.click(respond_and_update, [msg, chatbot], [chatbot, msg])
571
+ clear.click(clear_chat, outputs=[chatbot, msg])
572
+
573
+ return demo
574
 
575
  # ===============================================================================
576
  # END UI CONFIGURATION SECTION