Jaward commited on
Commit
f48bf9a
·
verified ·
1 Parent(s): dcdbbc3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -19
app.py CHANGED
@@ -1,6 +1,6 @@
1
  # Lectūra Research Demo: A Multi-Agent Tool for Self-taught Mastery.
2
  # Author: Jaward Sesay
3
- # © Lectūra Labs. All rights reserved.
4
  import os
5
  import json
6
  import re
@@ -975,14 +975,6 @@ Example: 'Received {total_slides} slides, {total_slides} scripts, and HTML files
975
 
976
  # custom js
977
  js_code = """
978
- function refresh() {
979
- const url = new URL(window.location);
980
-
981
- if (url.searchParams.get('__theme') !== 'light') {
982
- url.searchParams.set('__theme', 'light');
983
- window.location.href = url.href;
984
- }
985
- }
986
  () => {
987
  // Function to wait for an element to appear in the DOM
988
  window.addEventListener('load', function () {
@@ -1467,7 +1459,7 @@ async def study_mode_process(file, api_service, api_key):
1467
  with gr.Blocks(
1468
  title="Lectūra AI",
1469
  css="""
1470
- h1, h2, h3, {text-align: center;}
1471
  .gradio-container-5-29-0 .prose :last-child {color: #fff !important; }
1472
  #lecture-container {font-family: 'Times New Roman', Times, serif;}
1473
  #slide-content {font-size: 48px; line-height: 1.2;}
@@ -1511,18 +1503,13 @@ with gr.Blocks(
1511
  #chat-input-row {align-items: center !important;}
1512
  .gradio-container { background-color: white !important; color: black !important;}
1513
  main {max-width: fit-content !important}
1514
- .gradio-container.gradio-container-5-32-0 .contain #component-36 {
1515
- height: 460px !important;
1516
- }
1517
  """,
1518
  js=js_code,
1519
  head='<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">'
1520
  ) as demo:
1521
  gr.Markdown("""
1522
- ## <center>Lectūra: Your AI Genie for Self-taught Mastery.</center>""")
1523
- gr.Markdown("""
1524
- ### <center>(Disclaimer: This demo is part of a submission to the AgentX – LLM Agents MOOC Competition, hosted by Berkeley RDI. © Lectūra Labs. All rights reserved)</center>""")
1525
- gr.Markdown("""<center>Note: Genarating lecture speech takes a while, given that this demo is running on cpu. Recommend limit number of slides to 3 on cpu. For faster generation, please run the app with access to GPU.<center>""")
1526
 
1527
  # Add mode tabs
1528
  with gr.Row():
@@ -1599,7 +1586,7 @@ with gr.Blocks(
1599
  chat_history_state = gr.State([]) # List of {user, assistant}
1600
 
1601
  with gr.Row():
1602
- with gr.Column(scale=1, elem_id="notes-section"):
1603
  with gr.Row():
1604
  add_note_btn = gr.Button("+ Add note", elem_id="add-note-btn")
1605
  study_guide_btn = gr.Button("Study Guide", elem_id="study-guide-btn")
@@ -1613,7 +1600,7 @@ with gr.Blocks(
1613
  save_note_btn = gr.Button("Save Note", elem_id="save-note-btn")
1614
  back_btn = gr.Button("Back", elem_id="back-btn")
1615
 
1616
- with gr.Column(scale=1, elem_id="chat-section"):
1617
  with gr.Column():
1618
  chatbot = gr.Chatbot(label="Chat", elem_id="chatbot", height=220, show_copy_button=True, type="messages")
1619
  with gr.Row(elem_id="chat-input-row"):
 
1
  # Lectūra Research Demo: A Multi-Agent Tool for Self-taught Mastery.
2
  # Author: Jaward Sesay
3
+ # License: All rights reserved.
4
  import os
5
  import json
6
  import re
 
975
 
976
  # custom js
977
  js_code = """
 
 
 
 
 
 
 
 
978
  () => {
979
  // Function to wait for an element to appear in the DOM
980
  window.addEventListener('load', function () {
 
1459
  with gr.Blocks(
1460
  title="Lectūra AI",
1461
  css="""
1462
+ h3 {text-align: center; color: #000 !important;}
1463
  .gradio-container-5-29-0 .prose :last-child {color: #fff !important; }
1464
  #lecture-container {font-family: 'Times New Roman', Times, serif;}
1465
  #slide-content {font-size: 48px; line-height: 1.2;}
 
1503
  #chat-input-row {align-items: center !important;}
1504
  .gradio-container { background-color: white !important; color: black !important;}
1505
  main {max-width: fit-content !important}
1506
+ #component-36 {height: 460px !important}
 
 
1507
  """,
1508
  js=js_code,
1509
  head='<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">'
1510
  ) as demo:
1511
  gr.Markdown("""
1512
+ ### <center>Lectūra: Your AI Genie for Self-taught Mastery.</center>""")
 
 
 
1513
 
1514
  # Add mode tabs
1515
  with gr.Row():
 
1586
  chat_history_state = gr.State([]) # List of {user, assistant}
1587
 
1588
  with gr.Row():
1589
+ with gr.Column(scale=1, elem_id="notes-section"): # NOTES SECTION (TOP)
1590
  with gr.Row():
1591
  add_note_btn = gr.Button("+ Add note", elem_id="add-note-btn")
1592
  study_guide_btn = gr.Button("Study Guide", elem_id="study-guide-btn")
 
1600
  save_note_btn = gr.Button("Save Note", elem_id="save-note-btn")
1601
  back_btn = gr.Button("Back", elem_id="back-btn")
1602
 
1603
+ with gr.Column(scale=1, elem_id="chat-section"): # CHAT SECTION (BOTTOM)
1604
  with gr.Column():
1605
  chatbot = gr.Chatbot(label="Chat", elem_id="chatbot", height=220, show_copy_button=True, type="messages")
1606
  with gr.Row(elem_id="chat-input-row"):