when I use AsyncInferenceClient,sometimes I recived 500 500 Internal Server Error like this:
aiohttp.client_exceptions.ClientResponseError: 500, message='', url='https://api-inference.huggingface.co/models/Shakker-Labs/FLUX.1-dev-LoRA-One-Click-Creative-Template'
.
My code just like this:
from huggingface_hub import AsyncInferenceClient
API_URL = "https://api-inference.huggingface.co/models/Shakker-Labs/FLUX.1-dev-LoRA-One-Click-Creative-Template"
headers = {
"Authorization": "Bearer hf_xxxxxxx",
"x-use-cache": "false"
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.content
image_bytes = query({
"inputs": "Astronaut riding a horse",
"parameters": {
"width": 512,
"height": 512
}
})
print(image_bytes)