Use this application as a basis for your writing content or to test out the unhinged nature of the GPT-2 language model. This project is built on Flask, a web framework that can be used to build web applications that utilize Python.
prosegeniedemo.mov
- Python 3.7+
- PyTorch
- Hugging Face - Transformers (You will use this to load the GPT-2 pre-trained model)
- Flask
- Install PyTorch
pip install torch
- Install Hugging Face Transformers
pip install transformers
- Install Flask
pip install Flask
- Install datasets for additional fine-tuning procedures
pip install datasets
Once installation is complete, you may proceed to copy my code from newapp.py
and essays.txt
. I rendered the HTML script in Flask, so you won’t need an index.html file for this project.
You can run the app in development mode by pasting the following command in your terminal:
python3 newapp.py
You should see your code running at http://127.0.0.1:5000/. Refresh the page to test a different prompt.
Now you can modify newapp.py
. To view the modified changes, ctrl + s newapp.py
, then refresh your browser. This will trigger the Flask debugger to restart.
For better results, try structuring your prompt as a narrative rather than as a command. For example, instead of saying "Tell me about (topic)," you could start with "Today, I learned about (topic)."