https://github.com/wcchu/writer
Use RNN with LSTM to generate new text in TensorFlow 2
https://github.com/wcchu/writer
keras python recurrent-neural-network tensorflow tensorflow-2
Last synced: about 2 months ago
JSON representation
Use RNN with LSTM to generate new text in TensorFlow 2
- Host: GitHub
- URL: https://github.com/wcchu/writer
- Owner: wcchu
- License: gpl-3.0
- Created: 2020-03-12T15:01:20.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-10-27T19:19:50.000Z (over 2 years ago)
- Last Synced: 2023-10-27T20:25:39.643Z (over 2 years ago)
- Topics: keras, python, recurrent-neural-network, tensorflow, tensorflow-2
- Language: Python
- Homepage:
- Size: 63.6 MB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Writer
Use RNN with LSTM to generate new text in TensorFlow 2.
## Training
I prepared 3 training datasets in `data/`:
1. `data/bible.txt` - The text of the King James Bible (https://www.kingjamesbibleonline.org/).
2. `data/trump.txt` - The tweets by Donald Trump until 2021-01-08 15:44:28 (https://www.thetrumparchive.com/). I removed the emojis in the way suggested in https://stackoverflow.com/a/44905730.
3. `data/shakespeare.txt` - The complete works of William Shakespeare (https://www.gutenberg.org/ebooks/100).
Use `DATA_DIR` in `learn.py` to choose the training dataset. Run `python learn.py` to build the model and save it in the checkpoint directory. All parameters are defined in the beginning part of the `learn.py` code.
## Writing
Run `python main.py` to deploy the writer locally. Open browser with `localhost:5000` (assuming default port is 5000). Add optional input arguments in the form of `localhost:5000/temp/seed/lmin/lmax` where `temp`, `seed`, `lmin`, `lmax` are temperature, seed text, minimal text length, and maximal text length. If they are not defined in the url, the default values in the beginning part of `main.py` code will be taken. I also deployed the app through google app engine to https://writer-01.ey.r.appspot.com. I expect the traffic to be very low so the daily spending limit is set to 1 USD. The access to the app might fail due to this limit.