pdx97 commited on
Commit
28fc30b
·
verified ·
1 Parent(s): 95a3b80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -55,14 +55,19 @@ import nltk
55
  import os
56
  import shutil
57
 
58
- # Step 1: Remove existing corrupted punkt data
59
  nltk_data_path = os.path.join(nltk.data.path[0], "tokenizers", "punkt")
60
  if os.path.exists(nltk_data_path):
61
  shutil.rmtree(nltk_data_path) # Remove corrupted version
62
 
63
- # Step 2: Download punkt again
 
 
64
  nltk.download("punkt")
65
 
 
 
 
66
  @tool # Register the function properly as a SmolAgents tool
67
  def fetch_latest_arxiv_papers(keywords: list, num_results: int = 5) -> list:
68
  """Fetches and ranks arXiv papers using BM25 keyword relevance.
 
55
  import os
56
  import shutil
57
 
58
+
59
  nltk_data_path = os.path.join(nltk.data.path[0], "tokenizers", "punkt")
60
  if os.path.exists(nltk_data_path):
61
  shutil.rmtree(nltk_data_path) # Remove corrupted version
62
 
63
+ print("✅ Removed old NLTK 'punkt' data. Reinstalling...")
64
+
65
+ # ✅ Step 2: Download the correct 'punkt' tokenizer
66
  nltk.download("punkt")
67
 
68
+ print("✅ Successfully installed 'punkt'!")
69
+
70
+
71
  @tool # Register the function properly as a SmolAgents tool
72
  def fetch_latest_arxiv_papers(keywords: list, num_results: int = 5) -> list:
73
  """Fetches and ranks arXiv papers using BM25 keyword relevance.