Kia09 commited on
Commit
dd66354
·
verified ·
1 Parent(s): da8225d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -23,14 +23,15 @@ def generate_image(prompt):
23
  )
24
 
25
  if response.status_code != 200:
26
- print("ERROR:", response.text)
27
- return "⚠️ Error: Couldn't generate image. Try a simpler prompt."
28
 
29
  data = response.json()
30
  image_base64 = data["artifacts"][0]["base64"]
31
  image_bytes = base64.b64decode(image_base64)
32
  return image_bytes
33
 
 
34
  iface = gr.Interface(
35
  fn=generate_image,
36
  inputs=gr.Textbox(label="Prompt", placeholder="Describe your image..."),
 
23
  )
24
 
25
  if response.status_code != 200:
26
+ print("ERROR:", response.text) # ← prints the full error in your Hugging Face logs
27
+ return f" ERROR: {response.text}" # also shows it on the screen
28
 
29
  data = response.json()
30
  image_base64 = data["artifacts"][0]["base64"]
31
  image_bytes = base64.b64decode(image_base64)
32
  return image_bytes
33
 
34
+
35
  iface = gr.Interface(
36
  fn=generate_image,
37
  inputs=gr.Textbox(label="Prompt", placeholder="Describe your image..."),