Machine Psychology: Python Generated Art

Overview

Machine Psychology: Python Generated Art

A limited collection of 64 algorithmically generated artwork. Each unique piece is then given a title by the OpenAI GPT-3 language model.

header_art

This repository contains the code logic to generate the artwork. You can check out the full gallery at https://www.mach-psy.com/ and view the NFTs on OpenSea.

Usage

If you want to use this from the root directory, first make sure ./src is on the PYTHONPATH.

export PYTHONPATH=$PYTHONPATH:"./src"  

(Optional) If you want to use OpenAI name generation, you also need to set up the API key otherwise the name generator will just label all pieces Untitled.

export OPENAI_API_KEY=<YOUR_API_KEY>

Now you can generate the collection.

python src/cmd_generate.py --collection "myCoolCollection" -n 100 -i 1

This will generate a set of artwork called myCoolCollection, starting at index 1, and it will make 100 pieces.

Output

In the output, we will have the actual artwork itself, like this:

art

There will also be a meta-data file.

{
    "item_id": "001",
    "title": "VANISHED DREAMS",
    "start_color_name": "Rangitoto",
    "end_color_name": "Bright Turquoise",
    "code": "A:512:2b3323:00ffe1:314.272.12:393.276.16:369.218.20:345.311.24:414.391.28:97.277.32:362.121.36:314.272.12:182.251.40:161.335.36:314.272.12"
}

And there will be a preview image that combines both things.

preview_art

Creation Process

Each item is generated by an algorithm. The first step is to pick the primary colors for the artwork. I pick a random HSV value in a range, then a secondary color based off of that.

def generate_starting_color():

    # Choose starting HSV values.
    h = random.random()
    s = random.choice([0.3, 0.5, 1, 1])  # Favor saturated colors.
    v = random.choice([0.2, 0.8])  # Either dark or bright.

    return Color.hsv_float_to_rgb_int((h, s, v))

I also name the colors (this is important later) using a color-lookup table that picks the closest (Euclidean distance) match on its HSV value.

The color-to-name mapping logic was ported from an open-source JS script by Chirag Mehta.

class ColorNameMapper:
    def __init__(self, hex_color_map: str) -> None:
        self.color_names: List[Color] = []
        ...

The art itself is then generated by drawing a series of connected lines, with variable thickness. The color and thickness changes between each point. These colors, points, and thickness are then serialized into a code like this:

A:512:332823:29ff00:392.293.12:341.337.16:208.141.20:294.207.24:392.293.12:196.286.28:119.371.32:139.350.36:137.330.40:392.293.12

...which is then used to render the image. In this way, the meta-data also contains a redundant back-up of the image itself.

Name Generation

Finally, this is the most interesting part for me. The title of each piece is also generated by machine as well.

The color names (e.g. Rangitoto, Bright Turquoise) are used as part of a prompt to OpenAI GPT-3 language model.

It comes up with some very interesting stories for each image. For example:

  • VANISHED DREAMS
  • LET’S BURN THE CROWS
  • FROZEN OCEAN

Together the names and the images are both machine generated, and evoke some story or emotion (at least to me), which is why I called this collection "Machine Psychology."

Owner
Pixegami Team
Pixegami Team
Machine learning models from Singapore's NLP research community

SG-NLP Machine learning models from Singapore's natural language processing (NLP) research community. sgnlp is a Python package that allows you to eas

AI Singapore | AI Makerspace 21 Dec 17, 2022
Simple GUI where you can enter an article and get a crisp summarized version.

Text-Summarization-using-TextRank-BART Simple GUI where you can enter an article and get a crisp summarized version. How to run: Clone the repo Instal

Rohit P 4 Sep 28, 2022
A Streamlit web app that generates Rick and Morty stories using GPT2.

Rick and Morty Story Generator This project uses a pre-trained GPT2 model, which was fine-tuned on Rick and Morty transcripts, to generate new stories

₸ornike 33 Oct 13, 2022
Paddle2.x version AI-Writer

Paddle2.x 版本AI-Writer 用魔改 GPT 生成网文。Tuned GPT for novel generation.

yujun 74 Jan 04, 2023
Mednlp - Medical natural language parsing and utility library

Medical natural language parsing and utility library A natural language medical

Paul Landes 3 Aug 24, 2022
[EMNLP 2021] LM-Critic: Language Models for Unsupervised Grammatical Error Correction

LM-Critic: Language Models for Unsupervised Grammatical Error Correction This repo provides the source code & data of our paper: LM-Critic: Language M

Michihiro Yasunaga 98 Nov 24, 2022
The aim of this task is to predict someone's English proficiency based on a text input.

English_proficiency_prediction_NLP The aim of this task is to predict someone's English proficiency based on a text input. Using the The NICT JLE Corp

1 Dec 13, 2021
apple's universal binaries BUT MUCH WORSE (PRACTICAL SHITPOST) (NOT PRODUCTION READY)

hyperuniversality investment opportunity: what if we could run multiple architectures in a single file, again apple universal binaries, but worse how

luna 2 Oct 19, 2021
Various Algorithms for Short Text Mining

Short Text Mining in Python Introduction This package shorttext is a Python package that facilitates supervised and unsupervised learning for short te

Kwan-Yuet 466 Dec 06, 2022
An open source library for deep learning end-to-end dialog systems and chatbots.

DeepPavlov is an open-source conversational AI library built on TensorFlow, Keras and PyTorch. DeepPavlov is designed for development of production re

Neural Networks and Deep Learning lab, MIPT 6k Dec 31, 2022
Unsupervised text tokenizer focused on computational efficiency

YouTokenToMe YouTokenToMe is an unsupervised text tokenizer focused on computational efficiency. It currently implements fast Byte Pair Encoding (BPE)

VK.com 847 Dec 19, 2022
Nmt - TensorFlow Neural Machine Translation Tutorial

Neural Machine Translation (seq2seq) Tutorial Authors: Thang Luong, Eugene Brevdo, Rui Zhao (Google Research Blogpost, Github) This version of the tut

6.1k Dec 29, 2022
HuggingTweets - Train a model to generate tweets

HuggingTweets - Train a model to generate tweets Create in 5 minutes a tweet generator based on your favorite Tweeter Make my own model with the demo

Boris Dayma 318 Jan 04, 2023
Python library for interactive topic model visualization. Port of the R LDAvis package.

pyLDAvis Python library for interactive topic model visualization. This is a port of the fabulous R package by Carson Sievert and Kenny Shirley. pyLDA

Ben Mabey 1.7k Dec 20, 2022
Kerberoast with ACL abuse capabilities

targetedKerberoast targetedKerberoast is a Python script that can, like many others (e.g. GetUserSPNs.py), print "kerberoast" hashes for user accounts

Shutdown 213 Dec 22, 2022
this repository has datasets containing information of Uber pickups in NYC from April 2014 to September 2014 and January to June 2015. data Analysis , virtualization and some insights are gathered here

uber-pickups-analysis Data Source: https://www.kaggle.com/fivethirtyeight/uber-pickups-in-new-york-city Information about data set The dataset contain

1 Nov 02, 2021
CCF BDCI BERT系统调优赛题baseline(Pytorch版本)

CCF BDCI BERT系统调优赛题baseline(Pytorch版本) 此版本基于Pytorch后端的huggingface进行实现。由于此实现使用了Oneflow的dataloader作为数据读入的方式,因此也需要安装Oneflow。其它框架的数据读取可以参考OneflowDataloade

Ziqi Zhou 9 Oct 13, 2022
Help you discover excellent English projects and get rid of disturbing by other spoken language

GitHub English Top Charts 「Help you discover excellent English projects and get

GrowingGit 544 Jan 09, 2023
100+ Chinese Word Vectors 上百种预训练中文词向量

Chinese Word Vectors 中文词向量 中文 This project provides 100+ Chinese Word Vectors (embeddings) trained with different representations (dense and sparse),

embedding 10.4k Jan 09, 2023
Hierarchical unsupervised and semi-supervised topic models for sparse count data with CorEx

Anchored CorEx: Hierarchical Topic Modeling with Minimal Domain Knowledge Correlation Explanation (CorEx) is a topic model that yields rich topics tha

Greg Ver Steeg 592 Dec 18, 2022