def create_url_safe_hash(data: bytes, digest_size=8):
    """Create a URL-safe short hash of the data. Used to generate unique short deep links."""
    import base64

    hash_obj = hashlib.blake2b(data, digest_size=digest_size, usedforsecurity=False)
    url_safe_hash = base64.urlsafe_b64encode(hash_obj.digest()).decode().rstrip("=")

    return url_safe_hash
Create a URL-safe short hash of the data. Used to generate unique short deep links.
gradio/route_utils.py