diff --git a/README.md b/README.md index eb7c27e0..8aedb3c1 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,19 @@ A simple API converting a user's proposed tweet into a veritable banger. gh repo clone effectiveaccelerationism/text-to-banger ``` -### Install and run the app +### Install and run script +``` +sudo chmod+x install.sh && chmod+x start.sh +sudo ./install.sh +``` +Insert your API key in window and press CTRL+O to save and CTRL+x to close and continue installation +``` +./start.sh +``` + + + +### Install and run the app manually ``` cd webapp npm install @@ -19,7 +31,7 @@ npm start The app will be running on http://localhost:3000 ### Run the OpenAI api server -Currently the app runs with an OpenAI API server, soon to be dismissed in favor of a custom finetuned model. To run the OpenAI API server, you need to have an OpenAI API key. You can get one [here](https://platform.openai.com/account/api-keys). Once you have your API key, create a file named `.env` in the `apiserver` directory and add the following line to it: +Currently the app runs with an OpenAI API server, soon to be dismissed in favor of a custom finetuned model. To run the OpenAI API server, you need to have an OpenAI API key. You can get one [here](https://platform.openai.com/account/api-keys). Once you have your API key, create a file named `.env` in the `api` directory and add the following line to it: ``` OPENAI_API_KEY=your-openai-key OPENAI_MODEL_NAME=text-davinci-003 diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..1525f873 --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash +echo "Starting Install..." + +# Check if the sudo command is available +if ! command -v sudo &>/dev/null; then + echo "Error: 'sudo' command is not available. Please install it or run this script as a superuser." + exit 1 +fi + +# Install dependencies +echo "Installing dependencies python3, pip, venv, npm" +sudo apt-get update +sudo apt-get install -y python3 npm python3-pip python3-venv +cd api +python3 -m venv env && source .venv/bin/activate +pip3 install -r requirements.txt +echo "Dependencies installed successfully." + +# Configure app +echo "Performing install and configuration." + +cp .env.example .env + +# Use nano to edit the .env file +nano .env + +cd .. +cd webapp +npm install # Uncomment this line if you want to install npm dependencies + +echo "Installation and configuration completed. Run start.sh to begin." diff --git a/start.sh b/start.sh new file mode 100644 index 00000000..4a09f0ef --- /dev/null +++ b/start.sh @@ -0,0 +1,15 @@ +#!/bin/bash +echo "Starting..." + +# Check if the gnome-terminal command is available +if command -v gnome-terminal &>/dev/null; then + # Open Terminal Windows + gnome-terminal -- bash -c "cd webapp && npm start" & + gnome-terminal -- bash -c "cd api && python3 -m venv env && source .venv/bin/activate && python3 server.py" & + + # Sleep to keep the script running and the terminal windows open + sleep 99999 +else + echo "Error: gnome-terminal is not installed or not in your PATH. Edit start.sh" +fi +