Trying to get your image gen API to work, particularly interrested in combining the style and character references for generation, but currently your API for photon-flash-1 is down. Read your error overview and it seems like this is a server side issue, which is backed up from the fact that photon-1 works fine.
import os
import time
import requests
from lumaai import LumaAI
client = LumaAI(
auth_token=luma_key,
)
generation = client.generations.image.create(
prompt="A girl riding a unicorn, drawn in disney style",
model="photon-flash-1",
character_ref={
"identity0": {
"images": [
"https://cezeawmbmacgrkgqdlti.supabase.co/storage/v1/object/public/page-images/0.6361215993871154.jpg"
]
}
}
)
completed = False
while not completed:
generation = client.generations.get(id=generation.id)
if generation.state == "completed":
completed = True
elif generation.state == "failed":
raise RuntimeError(f"Generation failed: {generation.failure_reason}")
print("Dreaming")
time.sleep(2)
image_url = generation.assets.image
# download the image
response = requests.get(image_url, stream=True)
with open(f'{generation.id}.jpg', 'wb') as file:
file.write(response.content)
print(f"File downloaded as {generation.id}.jpg")
Response:
Dreaming
Dreaming
Dreaming
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
File c:\Users\eirik\git\your-tale-ai\test_luma.py:30
[28](file:///C:/Users/eirik/git/your-tale-ai/test_luma.py:28) completed = True
[29](file:///C:/Users/eirik/git/your-tale-ai/test_luma.py:29) elif generation.state == "failed":
---> [30](file:///C:/Users/eirik/git/your-tale-ai/test_luma.py:30) raise RuntimeError(f"Generation failed: {generation.failure_reason}")
[31](file:///C:/Users/eirik/git/your-tale-ai/test_luma.py:31) print("Dreaming")
[32](file:///C:/Users/eirik/git/your-tale-ai/test_luma.py:32) time.sleep(2)
RuntimeError: Generation failed: Job failed
Trying to get your image gen API to work, particularly interrested in combining the style and character references for generation, but currently your API for photon-flash-1 is down. Read your error overview and it seems like this is a server side issue, which is backed up from the fact that photon-1 works fine.
Response: