Skip to content

Instantly share code, notes, and snippets.

@makeev
Created February 19, 2021 06:01
Show Gist options
  • Save makeev/31248bd2c7a6d54d9b256205e50c9f76 to your computer and use it in GitHub Desktop.
Save makeev/31248bd2c7a6d54d9b256205e50c9f76 to your computer and use it in GitHub Desktop.
import asyncio
from thispersondoesnotexist import get_online_person
from thispersondoesnotexist import save_picture
async def f():
picture = await get_online_person() # bytes representation of the image
# Save to a file
await save_picture(picture, "a_beautiful_person.jpeg")
# If no filename is provided, one will be generated using the checksum of the picture
# await save_picture(picture)
loop = asyncio.get_event_loop()
loop.run_until_complete(f())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment