import base64
import os.path
from volcengine.visual.VisualService import VisualService
def paint_dance(desc):
visual_service = VisualService()
visual_service.set_ak('你的AK')
visual_service.set_sk('你的SK')
# 高美感通用V1.3-文生图
form = {
"req_key": "high_aes",
"prompt": desc.strip(),
"model_version": "general_v1.3"
}
resp = visual_service.high_aes_smart_drawing(form)
data = base64.b64decode(resp['data']['binary_data_base64'][0])
with open('222.png', 'wb') as f:
f.write(data)
if __name__ == '__main__':
desc = '抽烟的猫'
paint_dance(desc)
AKSK获取地址:账号登录-火山引擎