eeenn commited on
Commit
d95a812
·
verified ·
1 Parent(s): 44a1f5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -54,6 +54,9 @@ def text_to_image(prompt: str) -> AgentImage:
54
  resp = requests.post(url, headers=headers, json={"inputs": prompt}, timeout=120)
55
  if resp.status_code != 200:
56
  raise RuntimeError(f"Inference API error {resp.status_code}: {resp.text[:200]}")
 
 
 
57
 
58
  img = Image.open(io.BytesIO(resp.content)).convert("RGB")
59
  return AgentImage(img)
 
54
  resp = requests.post(url, headers=headers, json={"inputs": prompt}, timeout=120)
55
  if resp.status_code != 200:
56
  raise RuntimeError(f"Inference API error {resp.status_code}: {resp.text[:200]}")
57
+ if not hf_token:
58
+ raise RuntimeError("HF_TOKEN is missing. Please add it in Settings → Variables and Secrets.")
59
+
60
 
61
  img = Image.open(io.BytesIO(resp.content)).convert("RGB")
62
  return AgentImage(img)