Skip to content

Commit

Permalink
Spacy autocheck
Browse files Browse the repository at this point in the history
- Downloads core-web-lg model automatically if not installed
  • Loading branch information
7Zenox committed Aug 17, 2024
1 parent 618928b commit 807fb7e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion django_vaani/connection/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@


import spacy
nlp = spacy.load('en_core_web_lg')
# Check if the 'en_core_web_lg' model is installed
try:
nlp = spacy.load('en_core_web_lg')
except OSError:
print("Model 'en_core_web_lg' not found. Installing now...")
spacy.cli.download('en_core_web_lg')
nlp = spacy.load('en_core_web_lg')
print("Model 'en_core_web_lg' installed successfully.")

MAX_LENGTH = 256

Expand Down

0 comments on commit 807fb7e

Please sign in to comment.