Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
31 changes: 31 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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."
15 changes: 15 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -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