Upload 2 files
Browse files- app.py +7 -1
- requirements.txt +0 -2
app.py
CHANGED
|
@@ -103,7 +103,13 @@ abbreviations = {
|
|
| 103 |
|
| 104 |
|
| 105 |
# Load Spacy model
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
def expand_abbreviations(text, abbreviations):
|
| 109 |
for abbr, expanded in abbreviations.items():
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
# Load Spacy model
|
| 106 |
+
try:
|
| 107 |
+
nlp = spacy.load("en_core_web_sm")
|
| 108 |
+
except OSError:
|
| 109 |
+
# In case the model is not linked correctly, manually load from installed path
|
| 110 |
+
from spacy.cli import download
|
| 111 |
+
download("en_core_web_sm")
|
| 112 |
+
nlp = spacy.load("en_core_web_sm")
|
| 113 |
|
| 114 |
def expand_abbreviations(text, abbreviations):
|
| 115 |
for abbr, expanded in abbreviations.items():
|
requirements.txt
CHANGED
|
@@ -5,5 +5,3 @@ tensorflow
|
|
| 5 |
spacy==3.5.0
|
| 6 |
# SpaCy model
|
| 7 |
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0.tar.gz
|
| 8 |
-
# Correct Pydantic version compatible with SpaCy
|
| 9 |
-
pydantic==1.10.11
|
|
|
|
| 5 |
spacy==3.5.0
|
| 6 |
# SpaCy model
|
| 7 |
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0.tar.gz
|
|
|
|
|
|