Skip to content

ronthekiehn/gpt-river

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpt-river

gptriver is no longer being hosted, if you'd like to self host it, see the section below!

if you just want to listen to lofi, on a site that doesn't work, you can still see the river at ronthekiehn.github.io/gpt-river

A testimate to how far language models have come. GPT River is an interactive art piece that generates a continuous flow of text using GPT-2. Users can contribute individual words that will be incorporated into the generated text stream, as well as GPT-2's context.

image

Stack

  • Flask + Huggingface Transfomers
  • Uses GPT-2 (124M)
  • Vanilla HTML CSS JS
  • Deployed using Coolify (shoutout!)

Host it locally!?

Installation

  1. Clone the repository:

    git clone https://github.com/ronthekiehn/gpt-river.git
    cd gpt-river
    
  2. Create and activate a virtual environment (recommended):

    python -m venv venv
    
    # On Windows
    venv\Scripts\activate
    
    # On macOS/Linux
    source venv/bin/activate
    
  3. Install dependencies using requirements.txt:

    pip install -r requirements.txt
    
  4. The first time you run the application, it will download the GPT-2 model (~500MB).

Running the Application

Option 1: Using Flask (Development)

flask run --host=0.0.0.0 --port=5000

Option 2: Using Gunicorn (Production)

gunicorn --threads 4 -w 1 -b 0.0.0.0:5000 app:app

Note: The application is designed to work with a single worker (-w 1) since it uses in-memory storage. Multiple workers would create separate instances of the text generator, or lose user contributions.

Accessing the Application

Once running, access the application in your web browser at:

http://localhost:5000

Customization

  • To change the base text prompt, modify the fallback_text variable in app.py
  • To adjust text generation parameters like temperature, edit the generate_text function
  • To modify the UI, edit the templates/index.html file

Acknowledgments

About

A testimate to how far language models have come

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published