|
@@ -1,5 +1,5 @@
|
|
import requests, os
|
|
import requests, os
|
|
-
|
|
|
|
|
|
+from config import *
|
|
def cls_process_openai(path, client_id, one_key, name_column, api_key="sk-iREtaVNjamaBArOTlc_2BfGFJVPiU-9EjSFMUspIPBT3BlbkFJxS0SMmKZD9L9UumPczee4VKawCwVeGBQAr9MgsWGkA",
|
|
def cls_process_openai(path, client_id, one_key, name_column, api_key="sk-iREtaVNjamaBArOTlc_2BfGFJVPiU-9EjSFMUspIPBT3BlbkFJxS0SMmKZD9L9UumPczee4VKawCwVeGBQAr9MgsWGkA",
|
|
proxy=False, chunk_size=100):
|
|
proxy=False, chunk_size=100):
|
|
# 定义请求的数据
|
|
# 定义请求的数据
|
|
@@ -13,7 +13,7 @@ def cls_process_openai(path, client_id, one_key, name_column, api_key="sk-iREtaV
|
|
"chunk_size":chunk_size
|
|
"chunk_size":chunk_size
|
|
}
|
|
}
|
|
# 发送 POST 请求
|
|
# 发送 POST 请求
|
|
- response = requests.post("http://172.28.5.44:8070/classify_openai/", json=data)
|
|
|
|
|
|
+ response = requests.post(f"http://{ip}:8070/classify_openai/", json=data)
|
|
|
|
|
|
# 处理响应
|
|
# 处理响应
|
|
if response.status_code == 200:
|
|
if response.status_code == 200:
|
|
@@ -31,7 +31,7 @@ def cls_process_bert(path, client_id, name_column):
|
|
"name_column": name_column
|
|
"name_column": name_column
|
|
}
|
|
}
|
|
# 发送 POST 请求
|
|
# 发送 POST 请求
|
|
- response = requests.post("http://172.28.5.44:8070/classify_bert/", json=data)
|
|
|
|
|
|
+ response = requests.post(f"http://{ip}:8070/classify_bert/", json=data)
|
|
|
|
|
|
# 处理响应
|
|
# 处理响应
|
|
if response.status_code == 200:
|
|
if response.status_code == 200:
|
|
@@ -52,7 +52,7 @@ def upload_process(file_path, client_id):
|
|
files = {
|
|
files = {
|
|
'file': (name, file, 'text/plain') # 'text/plain' 是文件类型,可以根据需要修改
|
|
'file': (name, file, 'text/plain') # 'text/plain' 是文件类型,可以根据需要修改
|
|
}
|
|
}
|
|
- response = requests.post("http://ip:port/uploadfile/", data=data, files=files)
|
|
|
|
|
|
+ response = requests.post(f"http://{ip}:8070/uploadfile/", data=data, files=files)
|
|
|
|
|
|
# 处理响应
|
|
# 处理响应
|
|
if response.status_code == 200:
|
|
if response.status_code == 200:
|
|
@@ -64,14 +64,22 @@ def upload_process(file_path, client_id):
|
|
print("错误信息:", response.text)
|
|
print("错误信息:", response.text)
|
|
return None
|
|
return None
|
|
|
|
|
|
-def both_process(path, client_id, one_key, name_column):
|
|
|
|
|
|
+def both_process_api(path, client_id, one_key, name_column):
|
|
file_path = upload_process(file_path=path, client_id=client_id)
|
|
file_path = upload_process(file_path=path, client_id=client_id)
|
|
if file_path:
|
|
if file_path:
|
|
cls_process_openai(path=file_path, client_id=client_id, one_key=one_key, name_column=name_column)
|
|
cls_process_openai(path=file_path, client_id=client_id, one_key=one_key, name_column=name_column)
|
|
|
|
|
|
|
|
+def both_process_bert(path, client_id, name_column):
|
|
|
|
+ file_path = upload_process(file_path=path, client_id=client_id)
|
|
|
|
+ if file_path:
|
|
|
|
+ cls_process_bert(path=file_path, client_id=client_id, name_column=name_column)
|
|
|
|
+
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
# both_process(path="E:/code/name_classify/data_before/人群分类-自建站2024.08.xlsx", client_id='wangdalin', one_key='网店单号', name_column='收货姓名')
|
|
# both_process(path="E:/code/name_classify/data_before/人群分类-自建站2024.08.xlsx", client_id='wangdalin', one_key='网店单号', name_column='收货姓名')
|
|
# upload_process(file_path="E:/code/name_classify/data_before/人群分类-自建站2024.08.xlsx", client_id='wangdalin')
|
|
# upload_process(file_path="E:/code/name_classify/data_before/人群分类-自建站2024.08.xlsx", client_id='wangdalin')
|
|
# cls_process_openai(path="./process/wangdalin\\人群分类-自建站2024.08.xlsx",client_id='wangdalin', one_key='网店单号', name_column='收货姓名')
|
|
# cls_process_openai(path="./process/wangdalin\\人群分类-自建站2024.08.xlsx",client_id='wangdalin', one_key='网店单号', name_column='收货姓名')
|
|
- cls_process_bert(path="./process/wangdalin/人群分类-自建站2024.08.xlsx",client_id='wangdalin', name_column='收货姓名')
|
|
|
|
|
|
+ # cls_process_bert(path="./process/wangdalin/人群分类-自建站2024.08.xlsx",client_id='wangdalin', name_column='收货姓名')
|
|
|
|
+ both_process_bert(path='/dalin/name_classify/process/1售后Shopify退货人群匹配0902-0908.xlsx', client_id='wangdalin', name_column='姓名')
|
|
|
|
+ # cls_process_bert(path='/mnt/e/code/name_classify/process/wangdalin/3销售Shopify人群分析0902-0908_classify_error.xlsx', client_id='wangdalin', name_column='姓名')
|
|
|
|
+
|
|
|
|
|