gwdoc/apitest.py

18 lines
754 B
Python

import base64
import requests
url = "http://192.168.0.46:59085/split_image"
image_path = r"E:\ZKYNLP\aidocproject\audiotransaction\gwdoc\船舶图片.png"
with open(image_path, "rb") as f:
image_base64 = base64.b64encode(f.read()).decode("utf-8")
payload = {
"content": "船舶主发动机为低速二冲程船用推进柴油机,是船舶推进系统的核心动力装置,其主要功能是将燃油化学能转化为机械能,通过曲轴输出转矩,驱动推进轴系和螺旋桨,实现船舶航行。![图片](/api/v1/knowledge/files/images/船舶图片.png)",
"filename": "船舶图片.png",
"image_base64": image_base64,
}
resp = requests.post(url, json=payload, timeout=120)
print(resp.status_code)
print(resp.json())