https://github.com/ggiuffre/tf-lyrics
Generate lyrics with TensorFlow and the Genius API
https://github.com/ggiuffre/tf-lyrics
data-pipeline genius-api lyrics tensorflow text-generation
Last synced: about 1 year ago
JSON representation
Generate lyrics with TensorFlow and the Genius API
- Host: GitHub
- URL: https://github.com/ggiuffre/tf-lyrics
- Owner: ggiuffre
- License: mit
- Created: 2020-02-27T21:29:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-06T15:57:37.000Z (about 6 years ago)
- Last Synced: 2025-03-22T06:35:04.699Z (over 1 year ago)
- Topics: data-pipeline, genius-api, lyrics, tensorflow, text-generation
- Language: Python
- Homepage: https://ggiuffre.github.io/tf-lyrics/
- Size: 960 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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](https://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](http://karpathy.github.io/2015/05/21/rnn-effectiveness/) and
[Text generation with an
RNN](https://www.tensorflow.org/tutorials/text/text_generation).
## Usage
```python
from tflyrics import Poet, LyricsGenerator
artists = ['Bob Dylan', 'Tim Buckley', 'The Beatles']
gen = LyricsGenerator(artists, per_artist=5)
p = Poet()
p.train_on(gen, n_epochs=10)
poem = p.generate(start_string='Hey ', n_gen_chars=1000)
print(poem)
```
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.
You can find another, more data-intensive example on
[Google Colab](https://colab.research.google.com/drive/1OIYUbRawG5YEuQMunrR6Ox8S2UVI_Q6E).
This example also shows that `LyricsGenerator` doesn't need to wait for all
songs to be downloaded before providing the first training examples.
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](https://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=''`). `tflyrics` will detect this
environment variable automatically, if it exists.
## Installation
You can install this package with `pip`:
```shell
pip install -q tflyrics
```
Or, if you want the latest (possibly not stable) version, you can install
`tflyrics` from source with:
```shell
pip install -e git+https://github.com/ggiuffre/tf-lyrics.git#egg=tflyrics
```