kritsadaK commited on
Commit
7e5debb
·
verified ·
1 Parent(s): 67b15b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -7,14 +7,16 @@ import spacy
7
  import pandas as pd
8
  import re
9
  from transformers import pipeline
 
10
 
11
  # Load the spaCy model once at the start
12
  try:
13
- nlp = spacy.load("en_core_web_sm") # Ensure spaCy's model is installed
14
  st.write("spaCy model loaded successfully!")
15
  except OSError:
16
- nlp = None # Handle the case where the model is missing
17
  st.write("Failed to load spaCy model.")
 
 
18
 
19
  # Load the summarization model from Hugging Face Model Hub
20
  try:
 
7
  import pandas as pd
8
  import re
9
  from transformers import pipeline
10
+ import subprocess
11
 
12
  # Load the spaCy model once at the start
13
  try:
14
+ nlp = spacy.load("en_core_web_sm")
15
  st.write("spaCy model loaded successfully!")
16
  except OSError:
 
17
  st.write("Failed to load spaCy model.")
18
+ subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
19
+ nlp = spacy.load("en_core_web_sm")
20
 
21
  # Load the summarization model from Hugging Face Model Hub
22
  try: