This is the code for the whole pipeline and web interface described in Hafez: an Interactive Poetry Generation System.
For Rhyme Generation Code, please find it here For RNN with FSA decoding code, please find it here
You need a server with GPU and CUDA 8.0 installed.
- Unzip the RNN model files in
models
: Due to the model's large size (more than 1GB), please contact shixing19910105@gmail.com for the pretrained models.
cd models
gunzip lyrics.tl.nn.gz
gunzip lyrics.tl.topdown.nn
- Copy the rhyme generation code into the folder
sonnet-project-for-server/
cd sonnet-project-for-server
git clone https://github.com/Marjan-GH/Topical_poetry
- Follow the instruction to start the server for
Rhyme Generation
. - Start the RNN server:
cd sh
# start the normal server
bash run_server.sh
# start the interactive server
bash run_server_interactive.sh
- (Optional) You need to register a google clound datastore to log all the poems generated by the system.
- Start the web server:
If you didn't follow step 4, you may need to comments the related lines in
py/client.py
. (Happy Debugging !) Change thehost
inpy/client.py
to reflect your host address, Then run:
cd sh
bash run_client.sh
- Go to folder
jekyll/poem/data/js/
, for each javascript file, locate the variableapi_host
and change to your host server address. By default, we will use port 8080 for all our API call. - Build the webpage:
cd jekyll/poem
jekyll build
Then the built web pages are in jekyll/poem/_site/
Any questions, please contact Xing Shi