def classify(texts, output_format, architecture="gru", transformer=None): # load model model = Classifier('toxic_' + architecture) model.load() start_time = time.time() result = model.predict(texts, output_format) print("runtime: %s seconds " % (round(time.time() - start_time, 3))) return result
def classify(texts, output_format): # load model model = Classifier('toxic', "gru", list_classes=list_classes) model.load() start_time = time.time() result = model.predict(texts, output_format) print("runtime: %s seconds " % (round(time.time() - start_time, 3))) return result
def test(): # load model model = Classifier('toxic', "gru", list_classes=list_classes) model.load() print('loading test dataset...') xte = load_texts_pandas("data/textClassification/toxic/test.csv") print('number of texts to classify:', len(xte)) start_time = time.time() result = model.predict(xte, output_format="csv") print("runtime: %s seconds " % (round(time.time() - start_time, 3))) return result
def classify(texts, output_format): # load model model = Classifier('citations', "gru", list_classes=list_classes) model.load() start_time = time.time() result = model.predict(texts, output_format) runtime = round(time.time() - start_time, 3) if output_format is 'json': result["runtime"] = runtime else: print("runtime: %s seconds " % (runtime)) return result
def classify(texts, output_format, architecture="gru"): # load model model = Classifier('software_use', model_type=architecture, list_classes=list_classes) model.load() start_time = time.time() result = model.predict(texts, output_format) runtime = round(time.time() - start_time, 3) if output_format is 'json': result["runtime"] = runtime else: print("runtime: %s seconds " % (runtime)) return result
def classify(texts, output_format, architecture="gru", cascaded=False): ''' Classify a list of texts with an existing model ''' # load model model = Classifier('dataseer', model_type=architecture) model.load() start_time = time.time() result = model.predict(texts, output_format) runtime = round(time.time() - start_time, 3) if output_format is 'json': result["runtime"] = runtime else: print("runtime: %s seconds " % (runtime)) return result
def classify(texts, output_format, embeddings_name=None, architecture="gru", transformer=None): # load model model = Classifier('software_context_' + architecture) model.load() start_time = time.time() result = model.predict(texts, output_format) runtime = round(time.time() - start_time, 3) if output_format == 'json': result["runtime"] = runtime else: print("runtime: %s seconds " % (runtime)) return result