Spaces:
Running
Running
wzkariampuzha
commited on
Commit
·
5a9de0e
1
Parent(s):
d0df4c3
Update epi_pipeline.py
Browse files- epi_pipeline.py +3 -3
epi_pipeline.py
CHANGED
@@ -231,13 +231,13 @@ import spacy
|
|
231 |
import json
|
232 |
|
233 |
class Classify_Pipeline:
|
234 |
-
def __init__(self,
|
235 |
#Load spaCy models
|
236 |
self.nlp = spacy.load('en_core_web_lg')
|
237 |
self.nlpSci = spacy.load("en_ner_bc5cdr_md")
|
238 |
self.nlpSci2 = spacy.load('en_ner_bionlp13cg_md')
|
239 |
# load the tokenizer
|
240 |
-
with open('tokenizer.json') as f:
|
241 |
self.classify_tokenizer = tokenizer_from_json(json.load(f))
|
242 |
#OLD Code - used pickle which is unsafe
|
243 |
#with open(model+'/tokenizer.pickle', 'rb') as handle:
|
@@ -247,7 +247,7 @@ class Classify_Pipeline:
|
|
247 |
# but can also be run on any other tf.keras model
|
248 |
|
249 |
# load the model
|
250 |
-
self.classify_model = tf.keras.models.load_model(
|
251 |
# for preprocessing
|
252 |
from nltk.corpus import stopwords
|
253 |
self.STOPWORDS = set(stopwords.words('english'))
|
|
|
231 |
import json
|
232 |
|
233 |
class Classify_Pipeline:
|
234 |
+
def __init__(self,model_name:str='LSTM_RNN_Model'):
|
235 |
#Load spaCy models
|
236 |
self.nlp = spacy.load('en_core_web_lg')
|
237 |
self.nlpSci = spacy.load("en_ner_bc5cdr_md")
|
238 |
self.nlpSci2 = spacy.load('en_ner_bionlp13cg_md')
|
239 |
# load the tokenizer
|
240 |
+
with open(model_name+'/tokenizer.json') as f:
|
241 |
self.classify_tokenizer = tokenizer_from_json(json.load(f))
|
242 |
#OLD Code - used pickle which is unsafe
|
243 |
#with open(model+'/tokenizer.pickle', 'rb') as handle:
|
|
|
247 |
# but can also be run on any other tf.keras model
|
248 |
|
249 |
# load the model
|
250 |
+
self.classify_model = tf.keras.models.load_model(model_name)
|
251 |
# for preprocessing
|
252 |
from nltk.corpus import stopwords
|
253 |
self.STOPWORDS = set(stopwords.words('english'))
|