Skip to content

Commit

Permalink
updated readme and added link to source
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemcdonald committed Mar 4, 2019
1 parent ac115d7 commit d2274b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</head>

<body>
<h2><a href="https://github.com/kylemcdonald/gpt-2-poetry">gpt-2-poetry</a></h2>
<p>
This shows example output from <a href="https://github.com/openai/gpt-2">GPT-2</a> when primed with a 16 random
lines from <a
Expand Down
12 changes: 12 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# gpt-2-poetry

## Try the [demo](https://kylemcdonald.github.io/gpt-2-poetry/).

I used [download-urls.py](https://gist.github.com/kylemcdonald/3cbd09752e340849e4b3cb4f12dd8c85) to quickly download the HTML from [poetryfoundation.org](poetryfoundation.org) based on the urls in `romantic-urls.txt`.

Then I used `Parse Poetry.ipynb` to parse the HTML and extract the title, author, and poem. There are some glitches here with newlines being rendered in some places they shouldn't, and not being rendered in places where they should. This notebook saves a bunch of text files to `output/` that include metadata as the first few lines.

Then I used `Generate GPT-2.ipynb` to generate poems based on random chunks from the poems and the seed words. This notebook saves files to `poems.json` and `generated.json`. To run this notebook, first get [GPT-2](https://github.com/openai/gpt-2/) running, and drop the notebook in the `gpt-2/src/` directory.

Both Python notebooks import from `utils` which I have separately pushed [here](http://github.com/kylemcdonald/python-utils).

Finally, I load `generated.json` and `poems.json` with JavaScript in `index.html` and display the results.

0 comments on commit d2274b5

Please sign in to comment.