Spaces:
Running
Running
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")) |