Spaces:
Sleeping
Sleeping
Update TLDR.py
Browse files
TLDR.py
CHANGED
|
@@ -59,4 +59,55 @@ def run_code(event):
|
|
| 59 |
# print(test['abstract'], flush = True)
|
| 60 |
|
| 61 |
#return result_general
|
| 62 |
-
return result_arxiv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
# print(test['abstract'], flush = True)
|
| 60 |
|
| 61 |
#return result_general
|
| 62 |
+
return result_arxiv
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def update_mainTLDR():
|
| 66 |
+
global paper_list # Declare 'paper_list' as a global variable to store the search results
|
| 67 |
+
|
| 68 |
+
# Create a list to store the contents for the selected categories
|
| 69 |
+
content_list = []
|
| 70 |
+
|
| 71 |
+
# Check if any categories are selected
|
| 72 |
+
if buttons_to_add:
|
| 73 |
+
for category in buttons_to_add:
|
| 74 |
+
print("Used categories:", buttons_to_add, flush=True)
|
| 75 |
+
|
| 76 |
+
# Generate a Markdown object for each selected category
|
| 77 |
+
markdown = pn.pane.Markdown(f"# {category}")
|
| 78 |
+
first_flag = 1
|
| 79 |
+
for paper in paper_list:
|
| 80 |
+
# paper_title = "## " + paper['title'][0]
|
| 81 |
+
# paper_tldr = "### " + paper['abstract'][0]
|
| 82 |
+
# paper_date = "### " + paper['created'][0]
|
| 83 |
+
|
| 84 |
+
paper_title = "## " + paper.title
|
| 85 |
+
paper_tldr = paper.summary
|
| 86 |
+
paper_date = "### " + (paper.published).strftime("%d/%m/%Y %H:%M:%S")
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
if first_flag:
|
| 90 |
+
content = pn.Row(
|
| 91 |
+
markdown,
|
| 92 |
+
pn.Column(paper_title,
|
| 93 |
+
paper_tldr,
|
| 94 |
+
paper_date),
|
| 95 |
+
sizing_mode='stretch_width',
|
| 96 |
+
)
|
| 97 |
+
first_flag = 0
|
| 98 |
+
else:
|
| 99 |
+
content = pn.Row(
|
| 100 |
+
pn.Column(
|
| 101 |
+
paper_title,
|
| 102 |
+
paper_tldr,
|
| 103 |
+
paper_date),
|
| 104 |
+
sizing_mode='stretch_width',
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
content_list.append(content)
|
| 108 |
+
#content_list.append(content)
|
| 109 |
+
else:
|
| 110 |
+
# If no categories are selected, display the default message
|
| 111 |
+
content_list.append(pn.pane.Markdown("# Please select some tags!"))
|
| 112 |
+
|
| 113 |
+
return content_list
|