diff --git a/flask_predict_no_batch_t5.py b/flask_predict_no_batch_t5.py index 13885ed..1ad5ea9 100644 --- a/flask_predict_no_batch_t5.py +++ b/flask_predict_no_batch_t5.py @@ -1,7 +1,7 @@ import os # os.environ["TF_KERAS"] = "1" # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" -# os.environ["CUDA_VISIBLE_DEVICES"] = "1" +# os.environ["CUDA_VISIBLE_DEVICES"] = "-1" from flask import Flask, jsonify from flask import request # from linshi import autotitle @@ -45,11 +45,18 @@ def get_dialogs_index(line: str): def chulichangju_1(text, snetence_id, chulipangban_return_list, short_num): fuhao = [",","?","!","…"] + dialogs_text, dialogs_index, other_index = get_dialogs_index(text) + print(len(text)) text_1 = text[:120] text_2 = text[120:] text_1_new = "" + if text_2 == "": + chulipangban_return_list.append([text_1, snetence_id, short_num]) + return chulipangban_return_list for i in range(len(text_1)-1, -1, -1): if text_1[i] in fuhao: + if i in dialogs_index: + continue text_1_new = text_1[:i] text_1_new += text_1[i] chulipangban_return_list.append([text_1_new, snetence_id, short_num])