jeffrey1963 commited on
Commit
ebb3e5c
·
verified ·
1 Parent(s): a23a518

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -17,6 +17,12 @@ import os
17
  os.system("pip install --no-cache-dir numpy==1.23.5 spacy==3.5.3 thinc==8.1.8 pydantic<2.0")
18
  import spacy
19
 
 
 
 
 
 
 
20
 
21
  def extract_equation_params(text):
22
  """
 
17
  os.system("pip install --no-cache-dir numpy==1.23.5 spacy==3.5.3 thinc==8.1.8 pydantic<2.0")
18
  import spacy
19
 
20
+ # ✅ Load the NLP model **before using it**
21
+ try:
22
+ nlp = spacy.load("en_core_web_sm")
23
+ except OSError:
24
+ st.error("Spacy model 'en_core_web_sm' is not installed. Run `python -m spacy download en_core_web_sm` in your environment.")
25
+ nlp = None # Prevents crashing
26
 
27
  def extract_equation_params(text):
28
  """