You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.7 KiB
78 lines
2.7 KiB
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
@Time : 2022/12/29 1:14
|
|
@Author :
|
|
@FileName:
|
|
@Software:
|
|
@Describe:
|
|
"""
|
|
#coding:utf-8
|
|
|
|
import requests
|
|
from time import time
|
|
|
|
def dialog_line_parse(url, text):
|
|
"""
|
|
将数据输入模型进行分析并输出结果
|
|
:param url: 模型url
|
|
:param text: 进入模型的数据
|
|
:return: 模型返回结果
|
|
"""
|
|
|
|
response = requests.post(
|
|
url,
|
|
json=text,
|
|
timeout=1000
|
|
)
|
|
if response.status_code == 200:
|
|
return response.json()
|
|
else:
|
|
# logger.error(
|
|
# "【{}】 Failed to get a proper response from remote "
|
|
# "server. Status Code: {}. Response: {}"
|
|
# "".format(url, response.status_code, response.text)
|
|
# )
|
|
print("【{}】 Failed to get a proper response from remote "
|
|
"server. Status Code: {}. Response: {}"
|
|
"".format(url, response.status_code, response.text))
|
|
print(text)
|
|
return []
|
|
|
|
|
|
# ceshi_1 = [
|
|
# "李正旺你真是傻逼讪笑,挥手道:“不不不,你千万别误会。关于这件事,校长特别交代过了,我也非常认同。你这是见义勇为,是勇斗歹徒、义救同学的英雄,我们清江一中决不让英雄流血又流泪!”。",
|
|
# "李正旺你真是傻逼讪笑,挥手道:“不不不,你千万别误会。关于这件事,校长特别交代过了,我也非常认同。",
|
|
# "李正旺你真是傻逼讪笑,挥手道:“不不不,你千万别误会。关于这件事,校长特别交代过了,我也非常认同。"
|
|
# "我" * 110
|
|
# ]
|
|
#
|
|
# ceshi_2 = [
|
|
# "李正旺你真是傻逼讪笑,挥手道:“不不不,你千万别误会。关于这件事,校长特别交代过了,我也非常认同。你这是见义勇为,是勇斗歹徒,你这是见义勇为,你这是见义勇为,你这是见义勇为,你这是见义勇为,你这是见义勇为,你这是见义勇为,你这是见义勇为,你这是见义勇为,、义救同学的英雄,我们清江一中决不让英雄流血又流泪。”"
|
|
# ]
|
|
#
|
|
# ceshi_3 = [
|
|
# "方中乌药疏肝行气、散寒止痛为君药"
|
|
# ]
|
|
#
|
|
# jishu = 0
|
|
# for i in ceshi_1:
|
|
# for j in i:
|
|
# jishu += 1
|
|
# print(jishu)
|
|
#
|
|
# t1 = time()
|
|
# print(dialog_line_parse("http://192.168.31.116:14000/droprepeat/",{"texts": ceshi_2, "text_type": "focus"}))
|
|
# t2 = time()
|
|
# print(t2 -t1)
|
|
|
|
|
|
ceshi_2 = {
|
|
"0":"李正旺你真是傻逼讪笑,挥手道",
|
|
"1":"李正旺你真是傻逼讪笑,挥手道",
|
|
"2":"李正旺你真是傻逼讪笑,挥手道"
|
|
}
|
|
t1 = time()
|
|
print(dialog_line_parse("http://114.116.25.228:14000/predict",{"texts": ceshi_2, "text_type": "chapter"}))
|
|
t2 = time()
|
|
print(t2 -t1)
|