mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-03-14 09:47:41 +00:00
fix: check hf download failure
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = "23.9.3"
|
||||
__version__ = "23.10.0.dev0"
|
||||
|
||||
@@ -10,6 +10,7 @@ from PIL import Image, ImageDraw
|
||||
from rich import print
|
||||
|
||||
repo_id = "Bingsu/adetailer"
|
||||
_download_failed = False
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -20,12 +21,18 @@ class PredictOutput:
|
||||
|
||||
|
||||
def hf_download(file: str):
|
||||
global _download_failed
|
||||
|
||||
if _download_failed:
|
||||
return "INVALID"
|
||||
|
||||
try:
|
||||
path = hf_hub_download(repo_id, file)
|
||||
except Exception:
|
||||
msg = f"[-] ADetailer: Failed to load model {file!r} from huggingface"
|
||||
print(msg)
|
||||
path = "INVALID"
|
||||
_download_failed = True
|
||||
return path
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user