Coder Social home page Coder Social logo

david-lor / thispersondoesnotexistapi Goto Github PK

View Code? Open in Web Editor NEW
118.0 2.0 21.0 10 KB

Unofficial "API" for the ThisPersonDoesNotExist webpage, that returns a random fictional person picture generated by AI

License: Apache License 2.0

Python 100.00%
python thispersondoesnotexist people person human ai python3 requests python-requests

thispersondoesnotexistapi's Introduction

ThisPersonDoesNotExistAPI

Unofficial "API" for the ThisPersonDoesNotExist website.

What is ThisPersonDoesNotExist?

A page that returns a JPEG picture of a person that does not exist, because it has been generated using an AI. When opening the webpage, a image is returned directly, and refreshing the page will return a new image (although they can be repeated because the repository is limited and images are not generated on real time).

Some articles about it:

Why creating/using an "API"?

Why not? Use your imagination!

Requirements

  • Python 3.6
  • requests library
  • free time

Install it with pip

pip install git+https://github.com/David-Lor/ThisPersonDoesNotExistAPI

Usage

Get a person using function

from thispersondoesnotexist import get_online_person
picture = get_online_person()  # bytes representation of the image

# Save to a file
from thispersondoesnotexist import save_picture
save_picture(picture, "a_beautiful_person.jpeg")
# If no filename is provided, one will be generated using the checksum of the picture
save_picture(picture)

Get a person using class

from thispersondoesnotexist import Person
# Initialize with True to automatically get a person from the webpage
person = Person(fetch_online=True)

# Save to a file
person.save("a_beautiful_person.jpeg")
# If no filename is provided, one will be generated using the checksum of the picture
person.save()

Generate checksums

This can be useful if you want to create a scraper of fictional persons. You would be calling the methods to get random pictures, and to avoid repeating them, you can use their checksum - or just save with the auto-generated filename.

from thispersondoesnotexist import get_online_person, get_checksum_from_picture, Person

# Using object
person = Person(fetch_online=True)
checksum = person.get_checksum("md5")

# Using function
picture = get_online_person()
checksum2 = get_checksum_from_picture(picture)  # Method is optional, defaults to "md5"

thispersondoesnotexistapi's People

Contributors

alonsosilvaallende avatar david-lor avatar maliozer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

thispersondoesnotexistapi's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.