Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -52,10 +52,16 @@ from smolagents import CodeAgent, HfApiModel, tool
|
|
52 |
from rank_bm25 import BM25Okapi
|
53 |
import nltk
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
|
60 |
@tool # Register the function properly as a SmolAgents tool
|
61 |
def fetch_latest_arxiv_papers(keywords: list, num_results: int = 5) -> list:
|
|
|
52 |
from rank_bm25 import BM25Okapi
|
53 |
import nltk
|
54 |
|
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:
|