Spaces:
Running
Running
File size: 633 Bytes
291e480 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import asyncio
import fal_client
from dotenv import load_dotenv
import os
load_dotenv()
os.environ["FAL_KEY"] = os.getenv("FAL_API_KEY")
async def subscribe(keyword: str):
handler = await fal_client.submit_async(
"fal-ai/flux/schnell",
arguments={
"prompt": f"{keyword}, illustration style, white background, centered layout",
"image_size": "square_hd"
},
)
async for event in handler.iter_events(with_logs=True):
print(event)
result = await handler.get()
print(result["images"][0]["url"])
if __name__ == "__main__":
asyncio.run(subscribe("dog")) |