jeffrey1963 commited on
Commit
8f974ee
·
verified ·
1 Parent(s): 86ed5f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -12,17 +12,17 @@ os.system("pip install --no-cache-dir matplotlib")
12
  import matplotlib.pyplot as plt
13
  import pandas as pd
14
 
15
-
16
- 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
- # 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
  """
 
12
  import matplotlib.pyplot as plt
13
  import pandas as pd
14
 
 
 
 
15
  import spacy
16
+ import subprocess
17
 
18
+ # Ensure the model is installed
19
  try:
20
  nlp = spacy.load("en_core_web_sm")
21
  except OSError:
22
+ subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
23
+ nlp = spacy.load("en_core_web_sm")
24
+
25
+
26
 
27
  def extract_equation_params(text):
28
  """