utkarsh1797 commited on
Commit
b6bbf8d
Β·
verified Β·
1 Parent(s): 98ffeff

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +11 -1
src/streamlit_app.py CHANGED
@@ -8,7 +8,17 @@ from nltk import Tree
8
  import nltk
9
 
10
  # Setup NLTK and benepar
11
- nltk.download('punkt')
 
 
 
 
 
 
 
 
 
 
12
  benepar.download('benepar_en3')
13
 
14
  nlp = spacy.load("en_core_web_sm")
 
8
  import nltk
9
 
10
  # Setup NLTK and benepar
11
+
12
+ # πŸ‘‡ Set a safe, writable download path
13
+ nltk_data_path = os.path.join(os.getcwd(), "nltk_data")
14
+ os.makedirs(nltk_data_path, exist_ok=True)
15
+
16
+ # πŸ‘‡ Download the tokenizer to the safe location
17
+ nltk.download('punkt', download_dir=nltk_data_path)
18
+
19
+ # πŸ‘‡ Tell NLTK to look here for data
20
+ nltk.data.path.append(nltk_data_path)
21
+
22
  benepar.download('benepar_en3')
23
 
24
  nlp = spacy.load("en_core_web_sm")