taesiri commited on
Commit
1364bea
1 Parent(s): 41088df
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -32,6 +32,7 @@ gtag('config', 'G-EZ77X5T529');
32
  </script>
33
  """
34
 
 
35
  def replace_texttt(text):
36
  return re.sub(r"\\texttt\{(.*?)\}", r"*\1*", text)
37
 
@@ -54,8 +55,13 @@ def get_paper_info(paper_id):
54
 
55
 
56
  def get_paper_from_huggingface(paper_id):
 
 
 
57
  try:
58
- url = f"https://huggingface.co/datasets/taesiri/arxiv_db/raw/main/papers/{paper_id}.tex"
 
 
59
  response = requests.get(url)
60
  response.raise_for_status()
61
  return response.text
@@ -166,9 +172,12 @@ def load_context(paper_id):
166
  if os.path.getsize(temp_file_path) > 1:
167
  hf_api = HfApi(token=os.environ["HUGGINGFACE_TOKEN"])
168
 
 
 
 
169
  hf_api.upload_file(
170
  path_or_fileobj=temp_file_path,
171
- path_in_repo=f"papers/{paper_id}.tex",
172
  repo_id="taesiri/arxiv_db",
173
  repo_type="dataset",
174
  )
 
32
  </script>
33
  """
34
 
35
+
36
  def replace_texttt(text):
37
  return re.sub(r"\\texttt\{(.*?)\}", r"*\1*", text)
38
 
 
55
 
56
 
57
  def get_paper_from_huggingface(paper_id):
58
+ top_level_paper_id = paper_id.split(".")[0]
59
+ path_in_repo = f"papers/{top_level_paper_id}/{paper_id}.tex"
60
+
61
  try:
62
+ url = (
63
+ f"https://huggingface.co/datasets/taesiri/arxiv_db/raw/main/{path_in_repo}"
64
+ )
65
  response = requests.get(url)
66
  response.raise_for_status()
67
  return response.text
 
172
  if os.path.getsize(temp_file_path) > 1:
173
  hf_api = HfApi(token=os.environ["HUGGINGFACE_TOKEN"])
174
 
175
+ top_level_paper_id = paper_id.split(".")[0]
176
+ path_in_repo = f"papers/{top_level_paper_id}/{paper_id}.tex"
177
+
178
  hf_api.upload_file(
179
  path_or_fileobj=temp_file_path,
180
+ path_in_repo=path_in_repo,
181
  repo_id="taesiri/arxiv_db",
182
  repo_type="dataset",
183
  )