Spaces:
Running
Running
Update TLDR.py
Browse files
TLDR.py
CHANGED
|
@@ -60,50 +60,42 @@ def run_code(buttons_to_add, arxiv_tags, event = None):
|
|
| 60 |
|
| 61 |
|
| 62 |
def update_mainTLDR(buttons_to_add, paper_list):
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
# Create a list to store the contents for the selected categories
|
| 66 |
-
content_list = []
|
| 67 |
|
| 68 |
# Check if any categories are selected
|
| 69 |
if buttons_to_add:
|
| 70 |
for i in range(len(buttons_to_add)):
|
| 71 |
-
# print("Used categories:", buttons_to_add, flush=True)
|
| 72 |
-
|
| 73 |
# Generate a Markdown object for each selected category
|
| 74 |
-
|
| 75 |
for paper in paper_list[i]:
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
# paper_tldr = "### " + paper['abstract'][0]
|
| 79 |
-
# paper_date = "### " + paper['created'][0]
|
| 80 |
-
|
| 81 |
-
paper_title = "## " + paper.title
|
| 82 |
-
paper_tldr = paper.summary
|
| 83 |
paper_date = "### " + (paper.published).strftime("%d/%m/%Y %H:%M:%S")
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
pn.Column(paper_title,
|
| 89 |
-
paper_tldr,
|
| 90 |
-
paper_date),
|
| 91 |
-
sizing_mode='stretch_width'
|
| 92 |
-
)
|
| 93 |
-
first_flag = 0
|
| 94 |
-
else:
|
| 95 |
-
content = pn.Row(
|
| 96 |
-
pn.Column(
|
| 97 |
paper_title,
|
| 98 |
paper_tldr,
|
| 99 |
-
paper_date)
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
else:
|
| 106 |
# If no categories are selected, display the default message
|
| 107 |
-
|
| 108 |
|
| 109 |
-
return
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
def update_mainTLDR(buttons_to_add, paper_list):
|
| 63 |
+
# Create a Column to store the contents for the selected categories
|
| 64 |
+
main_tldr = pn.Column()
|
|
|
|
|
|
|
| 65 |
|
| 66 |
# Check if any categories are selected
|
| 67 |
if buttons_to_add:
|
| 68 |
for i in range(len(buttons_to_add)):
|
|
|
|
|
|
|
| 69 |
# Generate a Markdown object for each selected category
|
| 70 |
+
category_content = []
|
| 71 |
for paper in paper_list[i]:
|
| 72 |
+
paper_title = "## " + pn.pane.LaTeX(paper.title)
|
| 73 |
+
paper_tldr = paper.summary
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
paper_date = "### " + (paper.published).strftime("%d/%m/%Y %H:%M:%S")
|
| 75 |
+
|
| 76 |
+
# Create a Row to hold each paper's content
|
| 77 |
+
paper_content = pn.Row(
|
| 78 |
+
pn.Column(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
paper_title,
|
| 80 |
paper_tldr,
|
| 81 |
+
pn.pane.Markdown(paper_date)
|
| 82 |
+
),
|
| 83 |
+
sizing_mode='stretch_width',
|
| 84 |
+
)
|
| 85 |
+
category_content.append(paper_content)
|
| 86 |
+
|
| 87 |
+
# Create a Column for each category's content
|
| 88 |
+
category_column = pn.Column(
|
| 89 |
+
pn.pane.Markdown(f"# {buttons_to_add[i]}"),
|
| 90 |
+
*category_content, # Unpack the list of paper contents
|
| 91 |
+
sizing_mode='stretch_width'
|
| 92 |
+
)
|
| 93 |
+
|
| 94 |
+
# Add the category column to the main TLDR column
|
| 95 |
+
main_tldr.append(category_column)
|
| 96 |
+
|
| 97 |
else:
|
| 98 |
# If no categories are selected, display the default message
|
| 99 |
+
main_tldr.append(pn.pane.Markdown("# Please select some tags!"))
|
| 100 |
|
| 101 |
+
return main_tldr
|