rbiswasfc commited on
Commit
a67a3ad
·
1 Parent(s): aff34d8
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -27,12 +27,13 @@ app, rt = fast_app(html_style=(style,))
27
  login(token=os.environ.get("HF_TOKEN"))
28
 
29
  hf_user = whoami(os.environ.get("HF_TOKEN"))["name"]
30
- HF_REPO_ID = f"{hf_user}/zotero-articles"
 
31
 
32
- abstract_ds = load_dataset(HF_REPO_ID, "abstracts", split="train")
33
- article_ds = load_dataset(HF_REPO_ID, "articles", split="train")
34
 
35
- image_ds = load_dataset(HF_REPO_ID, "images", split="train")
36
  image_ds = image_ds.filter(lambda x: x["page_number"] == 1)
37
 
38
 
@@ -89,11 +90,7 @@ def generate_week_content(current_week):
89
  article_cards = []
90
  for arxiv_id in articles:
91
  article, abstract, image = get_article_details(arxiv_id)
92
- article_title = (
93
- article["contents"][0].get("paper_title", "article")
94
- if article["contents"]
95
- else "article"
96
- )
97
 
98
  card_content = [
99
  H5(
@@ -130,9 +127,7 @@ def generate_week_content(current_week):
130
  week_end = current_week + timedelta(days=6)
131
  return Div(
132
  nav_buttons,
133
- H3(
134
- f"Week of {current_week.strftime('%B %d')} - {week_end.strftime('%B %d, %Y')} ({len(articles)} articles)"
135
- ),
136
  grid,
137
  nav_buttons,
138
  id="content",
 
27
  login(token=os.environ.get("HF_TOKEN"))
28
 
29
  hf_user = whoami(os.environ.get("HF_TOKEN"))["name"]
30
+ HF_REPO_ID_TXT = f"{hf_user}/zotero-answer-ai-article-texts"
31
+ HF_REPO_ID_IMG = f"{hf_user}/zotero-answer-ai-article-images"
32
 
33
+ abstract_ds = load_dataset(HF_REPO_ID_TXT, "abstracts", split="train")
34
+ article_ds = load_dataset(HF_REPO_ID_TXT, "articles", split="train")
35
 
36
+ image_ds = load_dataset(HF_REPO_ID_IMG, "images", split="train")
37
  image_ds = image_ds.filter(lambda x: x["page_number"] == 1)
38
 
39
 
 
90
  article_cards = []
91
  for arxiv_id in articles:
92
  article, abstract, image = get_article_details(arxiv_id)
93
+ article_title = article["contents"][0].get("paper_title", "article") if article["contents"] else "article"
 
 
 
 
94
 
95
  card_content = [
96
  H5(
 
127
  week_end = current_week + timedelta(days=6)
128
  return Div(
129
  nav_buttons,
130
+ H3(f"Week of {current_week.strftime('%B %d')} - {week_end.strftime('%B %d, %Y')} ({len(articles)} articles)"),
 
 
131
  grid,
132
  nav_buttons,
133
  id="content",