From 570186ff64a0d0935ae46aa7c6480e4180d9c4b9 Mon Sep 17 00:00:00 2001 From: "majiahui@haimaqingfan.com" Date: Thu, 2 Mar 2023 12:24:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90t5=E5=8D=95=E6=9D=A1=E9=A2=84?= =?UTF-8?q?=E6=B5=8B=E7=89=88=E6=9C=AC,=E5=BC=95=E5=8F=B7=E4=B8=AD?= =?UTF-8?q?=E6=9C=89=E5=8F=A5=E5=8F=B7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_predict_no_batch_t5.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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])