Spaces:
Paused
Paused
Update app/lens_images_core.py
Browse files29 unmodified lines30313233343529 unmodified linesr"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",]def _find_chrome_binary() -> str | None:env = os.getenv("CHROME_BINARY")if env and shutil.which(env):29 unmodified lines3031323334353637383940414243444546474849505152535429 unmodified linesr"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",]_PROFILE_DIRS = []def _mk_profile_dir() -> str:base = os.getenv("CHROME_PROFILE_BASE", tempfile.gettempdir())# ผูกกับ PID + thread + UUID เพื่อไม่ชนกันp = os.path.join(base, f"chrome-profile-{os.getpid()}-{threading.get_ident()}-{uuid.uuid4().hex}")os.makedirs(p, exist_ok=True)_PROFILE_DIRS.append(p)return pdef _cleanup_profiles():for p in _PROFILE_DIRS:try:shutil.rmtree(p, ignore_errors=True)except Exception:passatexit.register(_cleanup_profiles)def _find_chrome_binary() -> str | None:env = os.getenv("CHROME_BINARY")if env and shutil.which(env):
app/lens_images_core.py+19