observantdistressed commited on
Commit
f9ea94d
·
verified ·
1 Parent(s): 30799f8

fix: error handlers in _download_custom_lora now return 2 values (markdown + dropdown)

Browse files

All error paths (cache and non-cache) were returning only 1 value
but the function has 2 output components [markdown, dropdown].
Added gr.update() no-op for the dropdown on every error path.

Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1538,9 +1538,9 @@ def _download_custom_lora(url, scale=1.0, trigger="", description="", tags=""):
1538
  try:
1539
  key = _load_lora_from_cache(cache_path)
1540
  except gr.Error as _e:
1541
- return gr.update(value=f"**❌ {_e}**", visible=True)
1542
  except Exception as _e:
1543
- return gr.update(value=f"**❌ Unexpected error loading cached LoRA: {_e}**", visible=True)
1544
  n = len(_CUSTOM_LoRA[key])
1545
  fname = os.path.basename(cache_path)
1546
  note = f" (scale {scale:g}" + (f", trigger `{trigger}`)" if trigger else ")")
@@ -1556,9 +1556,9 @@ def _download_custom_lora(url, scale=1.0, trigger="", description="", tags=""):
1556
  file = _resolve_repo_file(repo)
1557
  _ensure_custom_lora_loaded(repo, file)
1558
  except gr.Error as _e:
1559
- return gr.update(value=f"**❌ {_e}**", visible=True)
1560
  except Exception as _e:
1561
- return gr.update(value=f"**❌ Unexpected error loading the LoRA: {_e}**", visible=True)
1562
  n = len(_CUSTOM_LoRA[(repo, file)])
1563
  note = f" (scale {scale:g}" + (f", trigger `{trigger}`)" if trigger else ")")
1564
  # Auto-register in the community registry so others can find it.
 
1538
  try:
1539
  key = _load_lora_from_cache(cache_path)
1540
  except gr.Error as _e:
1541
+ return gr.update(value=f"**❌ {_e}**", visible=True), gr.update()
1542
  except Exception as _e:
1543
+ return gr.update(value=f"**❌ Unexpected error loading cached LoRA: {_e}**", visible=True), gr.update()
1544
  n = len(_CUSTOM_LoRA[key])
1545
  fname = os.path.basename(cache_path)
1546
  note = f" (scale {scale:g}" + (f", trigger `{trigger}`)" if trigger else ")")
 
1556
  file = _resolve_repo_file(repo)
1557
  _ensure_custom_lora_loaded(repo, file)
1558
  except gr.Error as _e:
1559
+ return gr.update(value=f"**❌ {_e}**", visible=True), gr.update()
1560
  except Exception as _e:
1561
+ return gr.update(value=f"**❌ Unexpected error loading the LoRA: {_e}**", visible=True), gr.update()
1562
  n = len(_CUSTOM_LoRA[(repo, file)])
1563
  note = f" (scale {scale:g}" + (f", trigger `{trigger}`)" if trigger else ")")
1564
  # Auto-register in the community registry so others can find it.