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.
20 lines
592 B
20 lines
592 B
1 year ago
|
import uuid
|
||
|
import json
|
||
|
import urllib.request
|
||
|
from Util import ConfigUtil
|
||
|
|
||
|
config = ConfigUtil.getConfig()
|
||
|
server_address = config.get('comfyui', 'server_address')
|
||
|
# 读取JSON/19.json
|
||
|
json_file = '../JSON/19.json'
|
||
|
with open(json_file, 'r', encoding="utf-8") as fi:
|
||
|
prompt = json.load(fi)
|
||
|
|
||
|
# 生成ClientID
|
||
|
client_id = str(uuid.uuid4())
|
||
|
|
||
|
p = {"prompt": prompt, "client_id": client_id}
|
||
|
modelData = json.dumps(p).encode('utf-8')
|
||
|
req = urllib.request.Request("http://{}/prompt".format(server_address), data=modelData)
|
||
|
print(json.loads(urllib.request.urlopen(req).read()))
|