Update DeepInfraImage.py

This commit is contained in:
H Lohaus 2024-04-11 03:52:37 +02:00 committed by GitHub
parent 4271fb9870
commit deb3898e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,5 +70,7 @@ class DeepInfraImage(AsyncGeneratorProvider, ProviderModelMixin):
await raise_for_status(response) await raise_for_status(response)
data = await response.json() data = await response.json()
images = data["output"] if "output" in data else data["images"] images = data["output"] if "output" in data else data["images"]
if not images:
raise RuntimeError(f"Response: {data}")
images = images[0] if len(images) == 1 else images images = images[0] if len(images) == 1 else images
return ImageResponse(images, prompt) return ImageResponse(images, prompt)