xianbao HF staff commited on
Commit
20255d6
1 Parent(s): 3e7fb88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -5,6 +5,10 @@ import io
5
 
6
  # 修改 generate_image 函数以处理图像生成并保存为临时文件
7
  def generate_image(api_key, prompt, aspect_ratio, model, negative_prompt, seed):
 
 
 
 
8
  response = requests.post(
9
  "https://api.stability.ai/v2beta/stable-image/generate/sd3",
10
  headers={
 
5
 
6
  # 修改 generate_image 函数以处理图像生成并保存为临时文件
7
  def generate_image(api_key, prompt, aspect_ratio, model, negative_prompt, seed):
8
+
9
+ if not api_key or not api_key.strip():
10
+ raise gr.Error("Please enter API key")
11
+
12
  response = requests.post(
13
  "https://api.stability.ai/v2beta/stable-image/generate/sd3",
14
  headers={