Spaces:
Running
Running
Update app.py
Browse files
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 |
-
#
|
4 |
import os
|
5 |
import json
|
6 |
import re
|
@@ -1511,8 +1511,8 @@ with gr.Blocks(
|
|
1511 |
) as demo:
|
1512 |
gr.Markdown("""
|
1513 |
## <center>Lectūra: Your AI Genie for Self-taught Mastery.</center>
|
1514 |
-
|
1515 |
-
### Note: Genarating lecture speech takes a while, given that this demo is running on cpu. Recommend
|
1516 |
# Add mode tabs
|
1517 |
with gr.Row():
|
1518 |
with gr.Column(scale=1):
|
@@ -1581,14 +1581,14 @@ with gr.Blocks(
|
|
1581 |
file_output = gr.File(label="Download Lecture Materials", elem_id="download")
|
1582 |
|
1583 |
# --- RIGHT COLUMN SPLIT: NOTES (TOP) AND CHAT (BOTTOM) ---
|
1584 |
-
with gr.Column(scale=1, elem_id="right-column"):
|
1585 |
# State for notes and lecture context
|
1586 |
notes_state = gr.State([]) # List of notes: [{"title": ..., "content": ...}]
|
1587 |
lecture_context_state = gr.State({}) # Dict with latest lecture slides/scripts
|
1588 |
chat_history_state = gr.State([]) # List of {user, assistant}
|
1589 |
|
1590 |
with gr.Row():
|
1591 |
-
with gr.Column(scale=1, elem_id="notes-section"):
|
1592 |
with gr.Row():
|
1593 |
add_note_btn = gr.Button("+ Add note", elem_id="add-note-btn")
|
1594 |
study_guide_btn = gr.Button("Study Guide", elem_id="study-guide-btn")
|
@@ -1602,7 +1602,7 @@ with gr.Blocks(
|
|
1602 |
save_note_btn = gr.Button("Save Note", elem_id="save-note-btn")
|
1603 |
back_btn = gr.Button("Back", elem_id="back-btn")
|
1604 |
|
1605 |
-
with gr.Column(scale=1, elem_id="chat-section"):
|
1606 |
with gr.Column():
|
1607 |
chatbot = gr.Chatbot(label="Chat", elem_id="chatbot", height=220, show_copy_button=True, type="messages")
|
1608 |
with gr.Row(elem_id="chat-input-row"):
|
@@ -1661,7 +1661,6 @@ with gr.Blocks(
|
|
1661 |
outputs=[note_response]
|
1662 |
)
|
1663 |
|
1664 |
-
# Save Note button: add note to state and update list, clear response
|
1665 |
async def save_note(note_title_val, note_content_val, notes, lecture_context, api_service, api_key, note_type=None):
|
1666 |
note = await run_note_agent(api_service, api_key, get_fallback_lecture_context(lecture_context, note_title_val, note_content_val, "", ""), note_title_val, note_content_val)
|
1667 |
# Prefix title with note type if provided
|
|
|
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
|
|
|
1511 |
) as demo:
|
1512 |
gr.Markdown("""
|
1513 |
## <center>Lectūra: Your AI Genie for Self-taught Mastery.</center>
|
1514 |
+
### <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>
|
1515 |
+
### Note: Genarating lecture speech takes a while, given that this demo is running on cpu. Recommend limiting number of slides to 3 on cpu. For faster generation, please run the app with access to GPU.""")
|
1516 |
# Add mode tabs
|
1517 |
with gr.Row():
|
1518 |
with gr.Column(scale=1):
|
|
|
1581 |
file_output = gr.File(label="Download Lecture Materials", elem_id="download")
|
1582 |
|
1583 |
# --- RIGHT COLUMN SPLIT: NOTES (TOP) AND CHAT (BOTTOM) ---
|
1584 |
+
with gr.Column(scale=1, elem_id="right-column"):
|
1585 |
# State for notes and lecture context
|
1586 |
notes_state = gr.State([]) # List of notes: [{"title": ..., "content": ...}]
|
1587 |
lecture_context_state = gr.State({}) # Dict with latest lecture slides/scripts
|
1588 |
chat_history_state = gr.State([]) # List of {user, assistant}
|
1589 |
|
1590 |
with gr.Row():
|
1591 |
+
with gr.Column(scale=1, elem_id="notes-section"):
|
1592 |
with gr.Row():
|
1593 |
add_note_btn = gr.Button("+ Add note", elem_id="add-note-btn")
|
1594 |
study_guide_btn = gr.Button("Study Guide", elem_id="study-guide-btn")
|
|
|
1602 |
save_note_btn = gr.Button("Save Note", elem_id="save-note-btn")
|
1603 |
back_btn = gr.Button("Back", elem_id="back-btn")
|
1604 |
|
1605 |
+
with gr.Column(scale=1, elem_id="chat-section"):
|
1606 |
with gr.Column():
|
1607 |
chatbot = gr.Chatbot(label="Chat", elem_id="chatbot", height=220, show_copy_button=True, type="messages")
|
1608 |
with gr.Row(elem_id="chat-input-row"):
|
|
|
1661 |
outputs=[note_response]
|
1662 |
)
|
1663 |
|
|
|
1664 |
async def save_note(note_title_val, note_content_val, notes, lecture_context, api_service, api_key, note_type=None):
|
1665 |
note = await run_note_agent(api_service, api_key, get_fallback_lecture_context(lecture_context, note_title_val, note_content_val, "", ""), note_title_val, note_content_val)
|
1666 |
# Prefix title with note type if provided
|