--- title: Moby Dick Story Generator emoji: 🐳 colorFrom: purple colorTo: yellow sdk: gradio sdk_version: 3.15.0 app_file: app.py pinned: false license: apache-2.0 --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference This is an app which asks the user to enter the beginning of a story (along with some parameter options) and returns a continuation of the input. The app uses a character-level Recurrent Neural Network (RNN) which was trained on a text file containing the novel Moby-Dick by Herman Melville: https://www.gutenberg.org/files/2701/2701-0.txt The RNN architecture is as follows: RNN( (embedding): Embedding(98, 256) (rnn): LSTM(256, 512, batch_first=True) (fc): Linear(in_features=512, out_features=98, bias=True) ) Note: the number of input and output features is 98, which is the number of unique characters appearing in the text of Moby-Dick. Here is that character set: {'O', 'Q', 'b', 'K', ',', 'W', 'l', 's', 'â', 'm', ':', 'Z', 'D', '*', 'u', '9', '”', '-', 'w', 'M', '7', '0', 'H', 'J', '?', ')', 'ו', 'Œ', '2', 'æ', 'o', '(', 'g', 'k', 'œ', 'X', 'ς', 'z', 'U', '‘', 'i', '&', 'T', '\n', 'a', 'ח', 'η', 'V', '.', '5', 'S', '!', 'n', 'q', '—', 'p', '1', 't', ']', '6', 'x', 'v', 'L', '3', '[', 'f', '8', '£', '$', 'j', 'τ', 'N', 'B', 'é', '4', 'A', ';', 'E', 'h', 'd', 'r', 'P', 'Y', 'è', 'R', 'y', 'c', 'ο', '’', 'I', 'G', ' ', 'ϰ', 'e', 'F', '“', '_', 'C'} The network was trained for 10000 epochs using the Adam optimizer and cross entropy loss function. Here are some of the loss values during training: Epoch 0 loss: 4.5816 Epoch 1000 loss: 1.5822 Epoch 2000 loss: 1.4782 Epoch 3000 loss: 1.4852 Epoch 4000 loss: 1.4038 Epoch 5000 loss: 1.3745 Epoch 6000 loss: 1.3924 Epoch 7000 loss: 1.3997 Epoch 8000 loss: 1.4276 Epoch 9000 loss: 1.3314 Epoch 9800 loss: 1.3500