Spaces:
Runtime error
Runtime error
paul hilders
commited on
Commit
•
b6d8689
1
Parent(s):
e070b4b
Resetting Spacy
Browse files- app.py +7 -7
- requirements.txt +1 -2
app.py
CHANGED
@@ -24,7 +24,7 @@ clip.clip._MODELS = {
|
|
24 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
25 |
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
|
26 |
|
27 |
-
nlp = spacy.load("en_core_web_sm")
|
28 |
|
29 |
# Gradio Section:
|
30 |
def run_demo(image, text):
|
@@ -45,13 +45,13 @@ def run_demo(image, text):
|
|
45 |
|
46 |
# Apply NER to extract named entities, and run the explainability method
|
47 |
# for each named entity.
|
48 |
-
highlighed_entities = []
|
49 |
-
for ent in nlp(text).ents:
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
print(highlighed_entities)
|
55 |
|
56 |
return overlapped, highlighted_text
|
57 |
|
|
|
24 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
25 |
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
|
26 |
|
27 |
+
# nlp = spacy.load("en_core_web_sm")
|
28 |
|
29 |
# Gradio Section:
|
30 |
def run_demo(image, text):
|
|
|
45 |
|
46 |
# Apply NER to extract named entities, and run the explainability method
|
47 |
# for each named entity.
|
48 |
+
# highlighed_entities = []
|
49 |
+
# for ent in nlp(text).ents:
|
50 |
+
# ent_text = ent.text
|
51 |
+
# ent_label = ent.label_
|
52 |
+
# highlighed_entities.append((ent_text, ent_label))
|
53 |
|
54 |
+
# print(highlighed_entities)
|
55 |
|
56 |
return overlapped, highlighted_text
|
57 |
|
requirements.txt
CHANGED
@@ -97,8 +97,7 @@ Shapely==1.8.2
|
|
97 |
six==1.16.0
|
98 |
sniffio==1.2.0
|
99 |
soupsieve==2.3.2.post1
|
100 |
-
spacy
|
101 |
-
en_core_web_sm @ https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl
|
102 |
stack-data==0.3.0
|
103 |
tangled-up-in-unicode==0.2.0
|
104 |
termcolor==1.1.0
|
|
|
97 |
six==1.16.0
|
98 |
sniffio==1.2.0
|
99 |
soupsieve==2.3.2.post1
|
100 |
+
spacy
|
|
|
101 |
stack-data==0.3.0
|
102 |
tangled-up-in-unicode==0.2.0
|
103 |
termcolor==1.1.0
|