GithubHelp home page GithubHelp logo

deep-learning-text-generator's Introduction

Deep learning text generator

A python script that uses deep learning to generate text - inspired by this blog post.

How it works

This script uses a Long short-term memory (LSTM) model and the parameters can be tweaked in /utils/constants.py.

Input file

You can provide a text file that will serve as the input for the algorithm to start learning.

  1. Make sure to save your input file in /input
  2. Update the filename of INPUT_FILE in /utils/constants.py.

Weights

Update the directory of WEIGHTS_FILE in /utils/constants.py.

  • If the weights file already exists, weights will be loaded from file when generating text.
  • If the weights file does not yet exist, weights will be generated and saved to the provided file name before generating text.

Running the script

First install packages by running

$ ./build

To start generating text, run

$ source ./env/bin/activate
$ python generate_text.py

To deactivate the virtualenv when done, run

$ deactivate

Feeling festive?

This repo contains an input file and some weights for generating Christmas Greetings. Very handy for writing some funny AI generated Christmas cards.

Make sure to set the following values in /utils/constants.py and you're good to go.

INPUT_FILE = "./input/christmas_greetings.txt"
WEIGHTS_FILE = "./weights/greetings_generator_50epochs.h5"
SEQUENCE_LENGTH = 50

Here's an example of Christmas Greetings the model can output.

Happy holidays.

Whishing you every happiness this christmas bnd throughout the new year ahead.

Have an ideal christmas an occasion that io celebrated as a reflection of your values, desires, affections, traditions.

Special thanks

Special thanks to Codebar Brighton for organising a Christmas show and tell which motivated me to finally have a play with machine learning.

deep-learning-text-generator's People

Contributors

nvlaarhoven avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.