Soundaryasos commited on
Commit
07cbcbe
·
verified ·
1 Parent(s): 435e603

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -7,10 +7,17 @@ import networkx as nx
7
  import matplotlib.pyplot as plt
8
  from transformers import pipeline
9
  from collections import Counter
 
 
 
 
 
 
 
 
10
 
11
  # Load NLP Models
12
  nltk.download("punkt")
13
- nlp = spacy.load("en_core_web_lg")
14
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
15
  qa_pipeline = pipeline("question-answering")
16
 
 
7
  import matplotlib.pyplot as plt
8
  from transformers import pipeline
9
  from collections import Counter
10
+ import os
11
+
12
+ # Ensure spaCy model is available
13
+ try:
14
+ nlp = spacy.load("en_core_web_lg")
15
+ except OSError:
16
+ os.system("python -m spacy download en_core_web_lg")
17
+ nlp = spacy.load("en_core_web_lg")
18
 
19
  # Load NLP Models
20
  nltk.download("punkt")
 
21
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
22
  qa_pipeline = pipeline("question-answering")
23