Update app.py
Browse files
app.py
CHANGED
|
@@ -13,12 +13,24 @@ import thinc
|
|
| 13 |
|
| 14 |
st.write(f"spaCy version: {spacy.__version__}")
|
| 15 |
st.write(f"Pydantic version: {pydantic.__version__}")
|
|
|
|
|
|
|
| 16 |
|
| 17 |
from modules.syntax_analysis import highlight_repeated_words, get_repeated_words_colors, POS_COLORS, POS_TRANSLATIONS, visualize_syntax
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
@st.cache_resource
|
| 20 |
def load_spacy_model():
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Load spaCy model
|
| 24 |
nlp = spacy.load("es_core_news_lg")
|
|
|
|
| 13 |
|
| 14 |
st.write(f"spaCy version: {spacy.__version__}")
|
| 15 |
st.write(f"Pydantic version: {pydantic.__version__}")
|
| 16 |
+
st.write(f"NumPy version: {np.__version__}")
|
| 17 |
+
st.write(f"Thinc version: {thinc.__version__}")
|
| 18 |
|
| 19 |
from modules.syntax_analysis import highlight_repeated_words, get_repeated_words_colors, POS_COLORS, POS_TRANSLATIONS, visualize_syntax
|
| 20 |
|
| 21 |
+
#@st.cache_resource
|
| 22 |
+
#def load_spacy_model():
|
| 23 |
+
# return spacy.load("es_core_news_lg")
|
| 24 |
+
|
| 25 |
@st.cache_resource
|
| 26 |
def load_spacy_model():
|
| 27 |
+
try:
|
| 28 |
+
nlp = spacy.load("es_core_news_lg")
|
| 29 |
+
except IOError:
|
| 30 |
+
st.info("Downloading spaCy model...")
|
| 31 |
+
spacy.cli.download("es_core_news_lg")
|
| 32 |
+
nlp = spacy.load("es_core_news_lg")
|
| 33 |
+
return nlp
|
| 34 |
|
| 35 |
# Load spaCy model
|
| 36 |
nlp = spacy.load("es_core_news_lg")
|