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.
62 lines
1.9 KiB
62 lines
1.9 KiB
![]()
2 years ago
|
import requests
|
||
|
import json
|
||
|
|
||
|
# def request_api_chatgpt(text):
|
||
|
#
|
||
|
# url = "http://192.168.31.74:15000/predict"
|
||
|
# data = {
|
||
|
# "texts": text
|
||
|
# }
|
||
|
# response = requests.post(url,
|
||
|
# data=json.dumps(data),
|
||
|
# timeout=1800)
|
||
|
#
|
||
|
# return response
|
||
|
|
||
|
|
||
|
url = "http://192.168.31.74:15000/predict"
|
||
|
|
||
|
def dialog_line_parse(text):
|
||
|
"""
|
||
|
将数据输入模型进行分析并输出结果
|
||
|
:param url: 模型url
|
||
|
:param text: 进入模型的数据
|
||
|
:return: 模型返回结果
|
||
|
"""
|
||
|
data = {
|
||
|
"texts": text
|
||
|
}
|
||
|
|
||
|
response = requests.post(
|
||
|
url,
|
||
|
json=data
|
||
|
)
|
||
|
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 []
|
||
|
|
||
|
|
||
|
title_list = ["幼小衔接下大班幼儿适应性的研究",
|
||
|
"基于51单片机的智能温控风扇设计",
|
||
|
"基于matlab的值指纹识别系统设计",
|
||
|
"财务舞弊的成因及防范措施研究",
|
||
|
"不孕症患者焦虑症状态及其影响因素",
|
||
|
"消费者网络购物影响因素分析",
|
||
|
"论恶意差评行为的法律定性与法律责任",
|
||
|
"一例急性心肌梗死患者冠脉术后的护理",
|
||
|
"上海财政扶持民办高等教育的问题及对策",
|
||
|
"生鲜冷链物流配送选址-路径优化问题研究"]
|
||
|
for i in title_list:
|
||
|
print(i)
|
||
|
dialog_line_parse(i)
|