Spaces:
Runtime error
Runtime error
fix: InferenceTimeoutError outdated
Browse files34 unmodified lines35363738394041174 unmodified lines2162172182192202212222 unmodified lines22522622722822923023123223323423523634 unmodified linesfrom huggingface_hub.inference._common import (TASKS_EXPECTING_IMAGES,ContentT,InferenceTimeoutError,ModelStatus,_b64_encode,_b64_to_image,174 unmodified lines)except TimeoutError as error:# Convert any `TimeoutError` to a `InferenceTimeoutError`raise InferenceTimeoutError(f"Inference call timed out: {url}") from error # type: ignoretry:hf_raise_for_status(response)2 unmodified linesif error.response.status_code == 503:# If Model is unavailable, either raise a TimeoutError...if timeout is not None and time.time() - t0 > timeout:raise InferenceTimeoutError(f"Model not loaded on the server: {url}. Please retry with a higher timeout (current:"f" {self.timeout}).",request=error.request,response=error.response,) from error# ...or wait 1s and retrylogger.info(f"Waiting for model to be loaded on the server: {error}")time.sleep(1)34 unmodified lines35363738394041174 unmodified lines2162172182192202212222 unmodified lines22522622722822923023123223323423523623723823924024124234 unmodified linesfrom huggingface_hub.inference._common import (TASKS_EXPECTING_IMAGES,ContentT,# InferenceTimeoutError,ModelStatus,_b64_encode,_b64_to_image,174 unmodified lines)except TimeoutError as error:# Convert any `TimeoutError` to a `InferenceTimeoutError`raise ValueError(f"Inference call timed out: {url}, {error}") # type: ignoretry:hf_raise_for_status(response)2 unmodified linesif error.response.status_code == 503:# If Model is unavailable, either raise a TimeoutError...if timeout is not None and time.time() - t0 > timeout:# raise InferenceTimeoutError(# f"Model not loaded on the server: {url}. Please retry with a higher timeout (current:"# f" {self.timeout}).",# request=error.request,# response=error.response,# ) from errorraise ValueError(f"Model not loaded on the server: {url}. Please retry with a higher timeout (current:"f" {self.timeout}), Err:{error}"# request=error.request,# response=error.response,)# ...or wait 1s and retrylogger.info(f"Waiting for model to be loaded on the server: {error}")time.sleep(1)
app.py+13-7