Spaces:
Sleeping
Sleeping
usmanyousaf
commited on
Commit
•
fa1459c
1
Parent(s):
61f309a
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,17 @@ from sklearn.metrics.pairwise import cosine_similarity
|
|
6 |
import spacy
|
7 |
|
8 |
# Load the SpaCy model
|
9 |
-
nlp = spacy.load("en_core_web_sm")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# Function to extract entities from text
|
12 |
def extract_entities(text):
|
|
|
6 |
import spacy
|
7 |
|
8 |
# Load the SpaCy model
|
9 |
+
#nlp = spacy.load("en_core_web_sm")
|
10 |
+
|
11 |
+
import spacy
|
12 |
+
try:
|
13 |
+
nlp = spacy.load("en_core_web_sm")
|
14 |
+
except OSError:
|
15 |
+
# If the model is not found, download it
|
16 |
+
from spacy.cli import download
|
17 |
+
download("en_core_web_sm")
|
18 |
+
nlp = spacy.load("en_core_web_sm")
|
19 |
+
|
20 |
|
21 |
# Function to extract entities from text
|
22 |
def extract_entities(text):
|