def post(
        self,
        url: str,
        json: serial_utils.JSON,
        timeout: float = threading_utils.DEFAULT_NETWORK_TIMEOUT,
    ) -> requests.Response:
        """Make an http post request to the huggingface api.

        This adds some additional logic beyond WithPost.post to handle
        huggingface-specific responses:

        - Model loading delay.
        - Overloaded API.
        - API error.
        """

        ret = super().post(url, json, timeout)

        j = ret.json()

        # Huggingface public api sometimes tells us that a model is loading and
        # how long to wait:
        if "estimated_time" in j:
            wait_time = j["estimated_time"]
            logger.error("Waiting for %s (%s) second(s).", j, wait_time)
            sleep(wait_time + 2)
            return self.post(url, json)

        elif isinstance(j, Dict) and "error" in j:
            error = j["error"]
            logger.error("API error: %s.", j)

            if error == "overloaded":
                logger.error("Waiting for overloaded API before trying again.")
                sleep(10.0)
                return self.post(url, json)
            else:
                raise RuntimeError(error)

        assert (
            isinstance(j, Sequence) and len(j) > 0
        ), f"Post did not return a sequence: {j}"

        return ret
Make an http post request to the huggingface api.

        This adds some additional logic beyond WithPost.post to handle
        huggingface-specific responses:

        - Model loading delay.
        - Overloaded API.
        - API error.
        
src/providers/huggingface/trulens/providers/huggingface/endpoint.py