main
黄海 1 year ago
parent 529ab06790
commit 908e4f9838

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

@ -0,0 +1,59 @@
# pip install psycopg2
import requests
from Util.AesUtil import *
from Util.CommonUtil import set_http_proxy
from Util.PgUtil import *
# 模型编号
model_id = 48
# 模型名称
model_name = '海的女儿'
# 模板类型
# 1:SD TXT2IMG 2:SD IMG2IMG 3:COMFY_UI
model_type_id = 2
'''
1 卡通风格
2 儿童摄影
3 风格写真
4 双人系列
'''
style_id = 2
# 是不是封面
is_cover = 1
# 提示信息
memo = '1、请上传正面半身照。; 2、确保脸部无遮挡3、图片要求不小于1.5MB(正常手机拍照即可)'
# 星级
star = 5
# 上传照片数量
img_count = 1
if __name__ == '__main__':
# 禁止代理
set_http_proxy("")
# 配置文件
config = ConfigUtil.getConfig()
# 处理机编号
machine_id = config['system']['machine_id']
# 获取签名
en_data = getenData(machine_id)
# WEB服务器地址
web_url = config['webServer']['web_url']
# 请求的地址
url = web_url + '/QingLong/HuiYa/addModel'
# 要发送的数据,可以是字典形式
data = {
"enData": en_data,
"model_name": model_name,
"memo": memo,
"star": star,
"img_count": img_count,
"model_type_id": model_type_id,
"style_id": style_id,
"is_cover": is_cover
}
# 发送POST请求
response = requests.post(url, data=data)
print(response.text)

@ -6,6 +6,21 @@ from datetime import datetime
import requests
from PIL import Image
import io
import urllib.parse
import urllib.request
# 是否启用代理
def set_http_proxy(proxy):
if proxy == None: # Use system default setting
proxy_support = urllib.request.ProxyHandler()
elif proxy == '': # Don't use any proxy
proxy_support = urllib.request.ProxyHandler({})
else: # Use proxy
proxy_support = urllib.request.ProxyHandler({'http': '%s' % proxy, 'https': '%s' % proxy})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
def submit_post(url: str, data: dict):
"""
@ -103,4 +118,3 @@ def split_4_image(image_path, out_path):
bottom_right.save(fi)
return res

@ -3,26 +3,12 @@ import time
import urllib.parse
import urllib.request
import urllib.parse
import urllib.request
import websocket
from Util.CommonUtil import *
# 是否启用代理
def set_http_proxy(proxy):
if proxy == None: # Use system default setting
proxy_support = urllib.request.ProxyHandler()
elif proxy == '': # Don't use any proxy
proxy_support = urllib.request.ProxyHandler({})
else: # Use proxy
proxy_support = urllib.request.ProxyHandler({'http': '%s' % proxy, 'https': '%s' % proxy})
opener = urllib.request.build_opener(proxy_support)
urllib.request.install_opener(opener)
# 定义一个函数向服务器队列发送提示信息
def queue_prompt(server_address, client_id, prompt):
p = {"prompt": prompt, "client_id": client_id}

@ -525,7 +525,7 @@ public class HuiYaController extends Controller {
*/
@Before({POST.class})
@EmptyInterface({"enData", "model_name", "memo"})
@IsNumericInterface({"model_id", "star", "img_count", "model_type_id", "style_id", "is_cover"})
@IsNumericInterface({"star", "img_count", "model_type_id", "style_id", "is_cover"})
public void addModel(String enData, String model_name, String memo, int star, int img_count, int model_type_id, int style_id, int is_cover) {
int success = AesUtil.CheckSignature(enData);
if (success <= 0) {

Loading…
Cancel
Save