Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
|