Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# File: app.py
|
| 2 |
import streamlit as st
|
| 3 |
|
| 4 |
+
from orchestrator.dispatcher import Dispatcher
|
| 5 |
+
from components.sidebar import render_sidebar
|
| 6 |
+
from components.paper_list import render_paper_list
|
| 7 |
+
from components.notebook_view import render_notebook
|
| 8 |
+
from components.graph_view import render_graph
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
st.set_page_config(page_title="AI Research Companion", layout="wide")
|
| 13 |
+
|
| 14 |
+
# Render sidebar and get user inputs
|
| 15 |
+
query, search_clicked = render_sidebar()
|
| 16 |
+
|
| 17 |
+
if search_clicked and query:
|
| 18 |
+
dispatcher = Dispatcher()
|
| 19 |
+
|
| 20 |
+
# 1. Search papers
|
| 21 |
+
papers = dispatcher.search_papers(query)
|
| 22 |
+
render_paper_list(papers)
|
| 23 |
+
|
| 24 |
+
# 2. Show notebook for the first paper
|
| 25 |
+
if papers:
|
| 26 |
+
first_id = papers[0]["id"]
|
| 27 |
+
notebook_cells = dispatcher.get_notebook_cells(first_id)
|
| 28 |
+
render_notebook(notebook_cells)
|
| 29 |
+
|
| 30 |
+
# 3. Visualize knowledge graph
|
| 31 |
+
graph_data = dispatcher.get_graph(first_id)
|
| 32 |
+
render_graph(graph_data)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
if __name__ == "__main__":
|
| 36 |
+
main()
|