Skip to content

tce9232/Bon-Iver-Text-Bot

Repository files navigation

Bot Iver - The Bon Iver Text Bot

Bot Iver learns how to write lyrics just like Justin Vernon by training over their entire discography.

Installation

Clone this repository into a local folder. In the command line, create a conda environment and activate it.

conda create -n botiver python=3.7 anaconda
conda activate -n botiver

Then install the required libraries in your environment.

 pip install -r requirements.txt

Since gpt-2, the language model we'll be training with only works with older versions of tensorflow, and pip doesn't support them, we need to install that separately with

 conda install tensorflow==1.15

Finally, we need to install ngrok as well to set up our secure tunnel for our chatbot. To do this we need to execute

 brew cask install ngrok

Model Training

In order to start using this app, you either need to train your initial model or download one I already trained.

Training your own model:

This option takes a bit more time and computing power. First, if you'd like to configure any variables in the machine learning model, open up and edit the config.yml file in the base folder. Without any edits, here are the original parameters:

create_model:
    data_path: 'data/BonIver.txt'
    model_name : '124M' 
    steps : 70 
    restore_from : 'fresh' 
    run_name : 'run1' 
    print_every : 5 
    sample_every : 10 
    save_every : 50

After you're comfortable with the parameters, navigate to the base folder in the command line. This folder should contain app.py.

Then in order to start training, run the following code in the command line:

make train

The training could take a while, but will ultimately result in model files in both the models and checkpoint folders.

Using my model:

In order to skip the training step, you can download the models and checkpoint folders directly from these Dropbox folders:

Unzip these in their respective folders.

Twilio Setup

You'll need to set up a Twilio account to interact with the text bot. Once you create your free account, create and name a new project.

After verifying your phone number, you can skip right to your Twilio dashboard. Here, you need to click the red "Get a trial number" button. This will give you your own Twilio trial phone number to use for this project.

Start Local Server

You need to start a server on your local computer in order for Twilio to interact with your model. To do this, navigate to the base folder in the command line and run

make server

Then open up another command line and run

ngrok http 8080

This should cause your window to go black with white text. Copy the forwarding address from here (it should end in ngrok.io). We need to tell Twilio to forward messages to this address.

Go to your Twilio dashboard and click on "Usage". Then your project name, then "Go to Phone Numbers". Click on the hyperlink of your phone number and scroll down to the bottom where it says "Messaging".

Paste the forwarding address in the webhook address for "a message comes in". Add "/sms" to the end of the address. Save the changes.

Test the Connection

At this point, your connection should be set up and you should be able to text your Twilio phone number any prefix you want and receive back original Bot Iver lyrics that start with that prefix.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages