ahm14 commited on
Commit
de1ac3b
·
verified ·
1 Parent(s): 0b619bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -4,8 +4,12 @@ from transformers import pipeline
4
  from langdetect import detect
5
  import spacy
6
 
7
- # Load NLP models
8
- nlp = spacy.load("en_core_web_sm")
 
 
 
 
9
 
10
  # Load Llama 3 summarization model
11
  llama_summarizer = pipeline("summarization", model="meta-llama/Meta-Llama-3-8B")
 
4
  from langdetect import detect
5
  import spacy
6
 
7
+ # Check if the spaCy model exists, if not, download it
8
+ model_name = "en_core_web_sm"
9
+ if not spacy.util.is_package(model_name):
10
+ os.system(f"python -m spacy download {model_name}")
11
+
12
+ nlp = spacy.load(model_name)
13
 
14
  # Load Llama 3 summarization model
15
  llama_summarizer = pipeline("summarization", model="meta-llama/Meta-Llama-3-8B")