utkarsh1797 commited on
Commit
56359e1
·
verified ·
1 Parent(s): 11b89ee

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +6 -1
src/streamlit_app.py CHANGED
@@ -9,13 +9,18 @@ import nltk
9
 
10
  # Setup NLTK and benepar
11
 
 
12
  nltk_data_path = "/tmp/nltk_data"
13
  nltk.download('punkt', download_dir=nltk_data_path)
14
  nltk.data.path.append(nltk_data_path)
15
 
16
  benepar.download('benepar_en3')
17
 
18
- nlp = spacy.load("en_core_web_sm")
 
 
 
 
19
  if "benepar" not in nlp.pipe_names:
20
  nlp.add_pipe("benepar", config={"model": "benepar_en3"})
21
 
 
9
 
10
  # Setup NLTK and benepar
11
 
12
+
13
  nltk_data_path = "/tmp/nltk_data"
14
  nltk.download('punkt', download_dir=nltk_data_path)
15
  nltk.data.path.append(nltk_data_path)
16
 
17
  benepar.download('benepar_en3')
18
 
19
+ try:
20
+ nlp = spacy.load("en_core_web_sm")
21
+ except:
22
+ subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
23
+ nlp = spacy.load("en_core_web_sm")
24
  if "benepar" not in nlp.pipe_names:
25
  nlp.add_pipe("benepar", config={"model": "benepar_en3"})
26