Skip to content

Commit

Permalink
report image generation error in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-sky committed Jun 30, 2023
1 parent d7ac99f commit 41c10f5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crazy_functions/图片生成.py
Expand Up @@ -27,8 +27,10 @@ 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']

try:
image_url = json.loads(response.content.decode('utf8'))['data'][0]['url']
except:
raise RuntimeError(response.content.decode())
# 文件保存到本地
r = requests.get(image_url, proxies=proxies)
file_path = 'gpt_log/image_gen/'
Expand Down

0 comments on commit 41c10f5

Please sign in to comment.