Spaces:
Running
Running
Update app2.py
Browse files
app2.py
CHANGED
|
@@ -13,6 +13,35 @@ def load_categories():
|
|
| 13 |
list_categories = f.readlines()
|
| 14 |
return list_categories
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
# Create buttons for the toggleable sidebar
|
|
@@ -66,8 +95,8 @@ def add_to_header(event):
|
|
| 66 |
filter_list.value = [] # Clear the selected options after adding them to the header
|
| 67 |
update_header() # Update the header after adding options
|
| 68 |
|
| 69 |
-
run_tldr = partial(run_code, buttons_to_add)
|
| 70 |
-
add_to_header_button.on_click(add_to_header
|
| 71 |
|
| 72 |
# Function to update the header layout with the newly created buttons
|
| 73 |
def update_header():
|
|
@@ -132,37 +161,6 @@ template = pn.template.FastListTemplate(
|
|
| 132 |
)
|
| 133 |
|
| 134 |
|
| 135 |
-
def run_code(event):
|
| 136 |
-
categories = buttons_to_add
|
| 137 |
-
print("!!!!!!!!!!!This:", categories, flush=True)
|
| 138 |
-
timeframe_today = (datetime.combine(date.today(), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 139 |
-
timeframe_week = timeframe_today + relativedelta(weekday=MO(-1))
|
| 140 |
-
|
| 141 |
-
timeframe_day = (datetime.combine(datetime(2023, 7, 16), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 142 |
-
|
| 143 |
-
search_mode = "NumberResults" #Accepted values: 'NumberResults' and 'Timeframe
|
| 144 |
-
sort_by = "Relevance" #Accepted values: 'PublishDate', 'LastUpdatedDate' and 'Relevance'
|
| 145 |
-
sort_order = "Descending" #Accepted values: 'Ascending' and 'Descending'
|
| 146 |
-
|
| 147 |
-
for category in categories:
|
| 148 |
-
query = category
|
| 149 |
-
search = Search_Papers(query, search_mode, 5, sort_by, sort_order)
|
| 150 |
-
# result_arxiv = search.search_arxiv()
|
| 151 |
-
result_general = search.search_general()
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
for test in result_general:
|
| 155 |
-
try:
|
| 156 |
-
print(test['title'])
|
| 157 |
-
print(test['subject'])
|
| 158 |
-
print(test['created'])
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
except:
|
| 162 |
-
print(test['created'])
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
|
| 167 |
|
| 168 |
|
|
|
|
| 13 |
list_categories = f.readlines()
|
| 14 |
return list_categories
|
| 15 |
|
| 16 |
+
def run_code(event):
|
| 17 |
+
categories = buttons_to_add
|
| 18 |
+
print("!!!!!!!!!!!This:", categories, flush=True)
|
| 19 |
+
timeframe_today = (datetime.combine(date.today(), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 20 |
+
timeframe_week = timeframe_today + relativedelta(weekday=MO(-1))
|
| 21 |
+
|
| 22 |
+
timeframe_day = (datetime.combine(datetime(2023, 7, 16), datetime.min.time())).replace(tzinfo = pytz.utc)
|
| 23 |
+
|
| 24 |
+
search_mode = "NumberResults" #Accepted values: 'NumberResults' and 'Timeframe
|
| 25 |
+
sort_by = "Relevance" #Accepted values: 'PublishDate', 'LastUpdatedDate' and 'Relevance'
|
| 26 |
+
sort_order = "Descending" #Accepted values: 'Ascending' and 'Descending'
|
| 27 |
+
|
| 28 |
+
for category in categories:
|
| 29 |
+
query = category
|
| 30 |
+
search = Search_Papers(query, search_mode, 5, sort_by, sort_order)
|
| 31 |
+
# result_arxiv = search.search_arxiv()
|
| 32 |
+
result_general = search.search_general()
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
for test in result_general:
|
| 36 |
+
try:
|
| 37 |
+
print(test['title'])
|
| 38 |
+
print(test['subject'])
|
| 39 |
+
print(test['created'])
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
except:
|
| 43 |
+
print(test['created'])
|
| 44 |
+
|
| 45 |
|
| 46 |
|
| 47 |
# Create buttons for the toggleable sidebar
|
|
|
|
| 95 |
filter_list.value = [] # Clear the selected options after adding them to the header
|
| 96 |
update_header() # Update the header after adding options
|
| 97 |
|
| 98 |
+
run_tldr = partial(run_code, buttons_to_add)
|
| 99 |
+
add_to_header_button.on_click(add_to_header)
|
| 100 |
|
| 101 |
# Function to update the header layout with the newly created buttons
|
| 102 |
def update_header():
|
|
|
|
| 161 |
)
|
| 162 |
|
| 163 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
|
| 165 |
|
| 166 |
|