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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -78,7 +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
- run_btn.update(interactive=False)
82
  """Single‑shot call (no more than `max_retries` times)."""
83
 
84
  if input_image is None:
@@ -124,8 +124,8 @@ def call_backend_with_retry(input_image: Image.Image, category: str, gender: str
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 ─────────
131
  custom_css = """
@@ -351,7 +351,7 @@ with gr.Blocks(css=custom_css, title="Jewellery Photography Preview") as demo:
351
  run_btn.click(
352
  fn=call_backend_with_retry,
353
  inputs=[input_img, category, gender],
354
- outputs=[out_overlay, out_bg, out_status],
355
  concurrency_limit=1,
356
  show_progress=True,
357
  )
 
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
+
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
+
128
+ return run_btn.update(interactive=False), None, None, "❌ Unknown error", run_btn.update(interactive=True)
129
 
130
  # ───────── CSS ─────────
131
  custom_css = """
 
351
  run_btn.click(
352
  fn=call_backend_with_retry,
353
  inputs=[input_img, category, gender],
354
+ outputs=[run_btn,out_overlay, out_bg, out_status,run_btn],
355
  concurrency_limit=1,
356
  show_progress=True,
357
  )