Spaces:
Runtime error
Runtime error
paul hilders
commited on
Commit
·
d80767e
1
Parent(s):
0241217
Import Spacy for NER
Browse files- app.py +4 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -7,6 +7,8 @@ sys.path.append("CLIP_explainability/Transformer-MM-Explainability/")
|
|
| 7 |
import torch
|
| 8 |
import CLIP.clip as clip
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
from clip_grounding.utils.image import pad_to_square
|
| 12 |
from clip_grounding.datasets.png import (
|
|
@@ -22,6 +24,8 @@ clip.clip._MODELS = {
|
|
| 22 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
|
| 24 |
|
|
|
|
|
|
|
| 25 |
# Gradio Section:
|
| 26 |
def run_demo(image, text):
|
| 27 |
orig_image = pad_to_square(image)
|
|
|
|
| 7 |
import torch
|
| 8 |
import CLIP.clip as clip
|
| 9 |
|
| 10 |
+
import spacy
|
| 11 |
+
|
| 12 |
|
| 13 |
from clip_grounding.utils.image import pad_to_square
|
| 14 |
from clip_grounding.datasets.png import (
|
|
|
|
| 24 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 25 |
model, preprocess = clip.load("ViT-B/32", device=device, jit=False)
|
| 26 |
|
| 27 |
+
NER = spacy.load("en_core_web_sm")
|
| 28 |
+
|
| 29 |
# Gradio Section:
|
| 30 |
def run_demo(image, text):
|
| 31 |
orig_image = pad_to_square(image)
|
requirements.txt
CHANGED
|
@@ -97,6 +97,7 @@ Shapely==1.8.2
|
|
| 97 |
six==1.16.0
|
| 98 |
sniffio==1.2.0
|
| 99 |
soupsieve==2.3.2.post1
|
|
|
|
| 100 |
stack-data==0.3.0
|
| 101 |
tangled-up-in-unicode==0.2.0
|
| 102 |
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
|