Installation
Requirements
- Python 3.10 or higher
- Docker is required to run this project. You can download it here.
- ffmpeg is required to run this project. You can download it here.
- Redis is required to run this project. You can download it with
sudo apt install redis
. - Hugging Face token is required to use the Hugging Face models. You can get a token here. You must also accept the terms and conditions for the models you want to use (here and here).
Installation
- Clone the repo
git clone https://github.com/TCU-ClassifAI/classifAI-engine.git
cd classifAI-engine
- Install Python packages (it is recommended to use a virtual environment)
pip install -r src/requirements.txt
- Install required system packages
# Install ffmpeg
sudo apt install ffmpeg # Ubuntu
brew install ffmpeg # MacOS
# install Redis
sudo apt install redis-server # Ubuntu
brew install redis # MacOS
# start Redis
sudo redis-server # Ubuntu
-
Set up the environment variables
-
For a full list of environment variables, see the Configuration documentation. This guide will cover a minimal set of environment variables to get the server running.
-
Create a
.env
file in the root directory of the project. The.env
file should contain the following environment variables:
# .env
HF_TOKEN=your_hugging_face_token # Get a token from https://hf.co/settings/tokens
REDIS_PORT=6379 #(default port for Redis, can be changed), the URL can also be changed (see config)
LLAMA_API_URL=http://localhost:5003 # URL for the LLAMA API
-
Edit values in
src/config/config.py
to match your environment. -
Launch the API
python src/app.py
- Run your RQ worker (you can do this through supervisor or another process manager)
rq worker -c config.worker_config
Test
curl http://localhost:5000/healthcheck
should return OK
More usage can be found in the API Documentation.
Installation on the GPU Server
Currently, it is run as a Systemd service. The service file is located at /etc/systemd/system/classifai.service
. The service can be started, stopped, and restarted using the following commands:
sudo systemctl start classifai
sudo systemctl stop classifai
sudo systemctl restart classifai
The logs can be viewed using the following command:
sudo journalctl -u classifai