|
|
@ -42,6 +42,7 @@ pantten_biaoti_0 = '^[1-9一二三四五六七八九ⅠⅡⅢⅣⅤⅥⅦⅧⅨ] |
|
|
|
pantten_biaoti_1 = '^第[一二三四五六七八九]章\s{0,}?[\u4e00-\u9fa5a-zA-Z]+' |
|
|
|
pantten_biaoti_2 = '^[0-9.]+\s{0,}?[\u4e00-\u9fa5a-zA-Z]+' |
|
|
|
pantten_biaoti_3 = '^[((][1-9一二三四五六七八九ⅠⅡⅢⅣⅤⅥⅦⅧⅨ][)_)][、.]{0,}?\s{0,}?[\u4e00-\u9fa5a-zA-Z]+' |
|
|
|
chatgpt_url = "http://114.116.25.228:12000/predict" |
|
|
|
|
|
|
|
|
|
|
|
class log: |
|
|
@ -349,12 +350,31 @@ def main(texts: dict): |
|
|
|
# index = output.request_id |
|
|
|
# generated_text = output.outputs[0].text |
|
|
|
# generated_text_list[int(index)] = generated_text |
|
|
|
generated_text_list = dialog_line_parse( |
|
|
|
"http://192.168.31.145:14010/predict", |
|
|
|
{ |
|
|
|
"texts":text_sentence |
|
|
|
} |
|
|
|
)["resilt"] |
|
|
|
|
|
|
|
## ============================================================ |
|
|
|
# generated_text_list = dialog_line_parse( |
|
|
|
# chatgpt_url, |
|
|
|
# { |
|
|
|
# "texts": text_sentence |
|
|
|
# } |
|
|
|
# )["data"] |
|
|
|
|
|
|
|
## ==================================================================== |
|
|
|
|
|
|
|
input_data = [] |
|
|
|
for i in range(len(text_sentence)): |
|
|
|
input_data.append([url, {"texts": text_sentence[i]}]) |
|
|
|
|
|
|
|
with concurrent.futures.ThreadPoolExecutor() as executor: |
|
|
|
# 使用submit方法将任务提交给线程池,并获取Future对象 |
|
|
|
futures = [executor.submit(dialog_line_parse, i[0], i[1]) for i in input_data] |
|
|
|
|
|
|
|
# 使用as_completed获取已完成的任务,并获取返回值 |
|
|
|
results = [future.result() for future in concurrent.futures.as_completed(futures)] |
|
|
|
|
|
|
|
generated_text_list = [] |
|
|
|
for dan in results: |
|
|
|
generated_text_list.append(dan["data"]) |
|
|
|
|
|
|
|
for i in range(len(generated_text_list)): |
|
|
|
# if len(text_list[i][0]) > 7: |
|
|
|