Skip to main content

Generate lyrics with TensorFlow and the Genius API

Project description

tflyrics

Generate intriguing lyrics with TensorFlow and an internet connection.

tflyrics is a Python package that allows you to easily select lyrics of specific artists from genius.com, and train a deep neural network to generate text that sounds similar to those lyrics. This work was inspired from The Unreasonable Effectiveness of Recurrent Neural Networks and Text generation with an RNN.

Example:

from tflyrics import Poet, LyricsGenerator

artists = ['Bob Dylan', 'Tim Buckley', 'The Beatles']
gen = LyricsGenerator(artists, per_artist=5)
ds = gen.as_dataset(batch_size=16)

p = Poet()
p.train_on(ds, n_epochs=10)
poem = p.generate(start_string='Hey ', n_gen_chars=1000)
print(poem)

Quick paraphrase: a LyricsGenerator object makes it easy for you to create a data pipeline that feeds from the Genius API directly into a recurrent neural network; a Poet object is a wrapper around a recurrent neural network.

Note that the Genius API requires you to have an access token. Without that, tflyrics won't be able to get lyrics for you. You can get an access token for free at docs.genius.com. Once you have it you can either pass it under the token argument of a LyricsGenerator constructor, or store it as en environment variable (with export GENIUS_ACCESS_TOKEN='<your token here>'). tflyrics will detect this environment variable automatically, if it exists.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tflyrics-0.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

tflyrics-0.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file tflyrics-0.1.tar.gz.

File metadata

  • Download URL: tflyrics-0.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for tflyrics-0.1.tar.gz
Algorithm Hash digest
SHA256 8786f3bf5d7ed8e7bea44bd03a9a62ea7c31bd56336c7e33b872e03d76d805fc
MD5 a9b455ee47320ff8a4e3d23c4dafb76b
BLAKE2b-256 e1a234c07879b39a6c548bea03f1f16074782e6762ccc0ed31a72db5671d9d63

See more details on using hashes here.

File details

Details for the file tflyrics-0.1-py3-none-any.whl.

File metadata

  • Download URL: tflyrics-0.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for tflyrics-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89527c4d3e896a610bd3172105c44c62cd2f7b37b3fb30e60ad71540d077d2bf
MD5 8ab929a91a36e205e6e9583a3ebb4248
BLAKE2b-256 fa147da5d112e2b54d1fc89060a4e7cb12c3037488e848253fb701dfa971afec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page