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.

39 lines
1.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# pip install psycopg2
from Util.PgUtil import *
# 修改操作(插入、更新或删除)
sql = "INSERT INTO t_hy_model(model_id,model_name,memo,star,update_time,img_count,b_use,sort_id,model_type_id) VALUES (%s,%s, %s,%s,now(),%s,1,1,%s);"
# 模型编号
model_id = 31
# 模型名称
model_name = '图片皮克斯风格化'
# 提示信息
memo = '1、请上传正面半身照。; 2、确保脸部无遮挡3、图片要求不小于1.5MB(正常手机拍照即可)'
# 星级
star = 5
# 上传照片数量
img_count = 1
# 模板类型
# 1WEBUI 2:COMFY_UI
model_type_id = 1
params = (model_id, model_name, memo, star, img_count, model_type_id)
execute_modify(sql, params)
# 模板的提示词初始化
prompts = [{"prompt_id": 1, "prompt": "1111", "img_url": "https://oss上的根据模型和指定提示词生成的样张.jpg"},
{"prompt_id": 2, "prompt": "2222", "img_url": "2222.jpg"},
{"prompt_id": 3, "prompt": "3333", "img_url": "3333.jpg"},
{"prompt_id": 4, "prompt": "4444", "img_url": "4444.jpg"},
{"prompt_id": 5, "prompt": "5555", "img_url": "5555.jpg"}, ]
sql = "insert into t_hy_model_prompt(model_id,prompt_id,prompt,img_url) values(%s,%s,%s,%s)"
for x in prompts:
prompt_id = x['prompt_id']
prompt = x['prompt']
img_url = x['img_url']
params = (model_id, prompt_id, prompt, img_url)
execute_modify(sql, params)