修复高级参数bug

This commit is contained in:
w_xiaolizu
2023-05-23 10:49:34 +08:00
parent 11cbfd33e9
commit 065257b6d8
5 changed files with 9 additions and 10 deletions

View File

@ -28,17 +28,16 @@ def gen_image(llm_kwargs, prompt, resolution="256x256"):
response = requests.post(url, headers=headers, json=data, proxies=proxies)
print(response.content)
image_url = json.loads(response.content.decode('utf8'))['data'][0]['url']
# 文件保存到本地
r = requests.get(image_url, proxies=proxies)
file_path = 'gpt_log/image_gen/'
os.makedirs(file_path, exist_ok=True)
file_name = 'Image' + time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()) + '.png'
with open(file_path+file_name, 'wb+') as f: f.write(r.content)
with open(file_path + file_name, 'wb+') as f:
f.write(r.content)
return image_url, file_path + file_name
return image_url, file_path+file_name
@CatchException