milliyin commited on
Commit
7ec1bc6
Β·
verified Β·
1 Parent(s): 1d8a0ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -33,7 +33,7 @@ backend_status = {
33
  def check_backend_connection():
34
  """Ping the HF Space and cache the client object."""
35
  try:
36
- test_client = Client("SnapwearAI/SAKS-backend", hf_token=HF_TOKEN)
37
  backend_status.update({
38
  "client": test_client,
39
  "connected": True,
@@ -78,6 +78,7 @@ def base64_to_image(b64: str) -> Image.Image | None:
78
 
79
  # ───────── UI ↔ Backend bridge ─────────
80
  def call_backend_with_retry(input_image: Image.Image, category: str, gender: str, *, max_retries: int = MAX_RETRIES):
 
81
  """Single‑shot call (no more than `max_retries` times)."""
82
 
83
  if input_image is None:
@@ -123,7 +124,7 @@ def call_backend_with_retry(input_image: Image.Image, category: str, gender: str
123
  if attempt == max_retries - 1:
124
  return None, None, f"❌ {e}"
125
  time.sleep(1)
126
-
127
  return None, None, "❌ Unknown error"
128
 
129
  # ───────── CSS ─────────
 
33
  def check_backend_connection():
34
  """Ping the HF Space and cache the client object."""
35
  try:
36
+ test_client = Client("milliyin/backend", hf_token=HF_TOKEN)
37
  backend_status.update({
38
  "client": test_client,
39
  "connected": True,
 
78
 
79
  # ───────── UI ↔ Backend bridge ─────────
80
  def call_backend_with_retry(input_image: Image.Image, category: str, gender: str, *, max_retries: int = MAX_RETRIES):
81
+ run_btn.update(interactive=False)
82
  """Single‑shot call (no more than `max_retries` times)."""
83
 
84
  if input_image is None:
 
124
  if attempt == max_retries - 1:
125
  return None, None, f"❌ {e}"
126
  time.sleep(1)
127
+ run_btn.update(interactive=True)
128
  return None, None, "❌ Unknown error"
129
 
130
  # ───────── CSS ─────────