This application allows you to generate text using either OpenAI's GPT API or the locally hosted LLaMA model. Follow the instructions below to set up the environment and run the app.
Make sure you have the following installed:
- Python 3.8 or higher
pipfor managing Python packages- A virtual environment setup tool (
venvorconda) - Access to the OpenAI API if using GPT, or download the LLaMA model for local usage.
-
Clone the repository:
git clone https://github.com/Xer0bit/BookWriter-Lamma3.1-OPENAI.git cd BookWriter-Lamma3.1-OPENAI -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On macOS/Linux:
source venv/bin/activate - On Windows:
venv\Scripts\activate
- On macOS/Linux:
-
Install the required packages:
pip install -r requirements.txt
-
Get your API key from OpenAI.
-
Create a
.envfile in the root directory and add the following:OPENAI_API_KEY=your_openai_api_key_here
-
The application will automatically use GPT for text generation once the API key is set in the
.envfile.
-
Download the LLaMA model from here.
-
Create the following directory structure inside the cloned repository:
mkdir -p meta-llama/Meta-Llama-3-8B-Instruct/original
-
Place the downloaded model files into the
meta-llama/Meta-Llama-3-8B-Instruct/originalfolder. -
The application will automatically use the local LLaMA model if no OPENAI_API_KEY is found in the
.envfile.
To run the application, simply execute the app.py file:
python app.py