Spaces:
Running
Running
add library
Browse files
app.py
CHANGED
@@ -12,8 +12,10 @@ import matplotlib.pyplot as plt
|
|
12 |
import models
|
13 |
import string
|
14 |
import nltk
|
15 |
-
nltk.download('punkt')
|
16 |
-
nltk.download('averaged_perceptron_tagger')
|
|
|
|
|
17 |
import torchvision
|
18 |
|
19 |
args = default_argument_parser().parse_args()
|
@@ -38,7 +40,7 @@ def run(sketch, caption, threshold, seed):
|
|
38 |
caption = caption.replace('\n',' ')
|
39 |
translator = str.maketrans('', '', string.punctuation)
|
40 |
caption = caption.translate(translator).lower()
|
41 |
-
words =
|
42 |
classes = get_noun_phrase(words)
|
43 |
if len(classes) ==0:
|
44 |
classes = [caption]
|
|
|
12 |
import models
|
13 |
import string
|
14 |
import nltk
|
15 |
+
# nltk.download('punkt')
|
16 |
+
# nltk.download('averaged_perceptron_tagger')
|
17 |
+
|
18 |
+
from nltk.tokenize import word_tokenize
|
19 |
import torchvision
|
20 |
|
21 |
args = default_argument_parser().parse_args()
|
|
|
40 |
caption = caption.replace('\n',' ')
|
41 |
translator = str.maketrans('', '', string.punctuation)
|
42 |
caption = caption.translate(translator).lower()
|
43 |
+
words = word_tokenize(caption)
|
44 |
classes = get_noun_phrase(words)
|
45 |
if len(classes) ==0:
|
46 |
classes = [caption]
|