- Svelte Web-app [Frontend]
- Running Django [Backend]
- Installation [Backend]
To run locally, refer to the instructions inside the Client directory README.
Make sure the .env file contains the following:
# Django secret key
SECRET_KEY = <KEY_VALUE>
# Use "False" for production
DEBUG = "True"- Navigate to the
Djangoproject root foldercd server - Run the
Djangodevelopment serverpython3 manage.py runserver
- Open browser and navigate to:
http://127.0.0.1:8000
- Navigate to the
Djangoproject root foldercd server - Run the
Djangodevelopment serverpython manage.py runserver
- Open browser and navigate to:
http://127.0.0.1:8000
If any changes are made to the Django models (database schemas), the changes need to be migrated to the database(s). Execute the following commands from the Django project root folder:
python3 manage.py makemigrations
python3 manage.py migrate
python3 manage.py migrate --database=db_imagesTo run the Django unit tests, execute the following commands from the Django project root folder:
python3 manage.py test Once you are done, deactivate the Python virtual environment using:
deactivate-
Navigate to the repository root folder in your terminal
cd /path/to/repository -
Create a Python virtual environment
python3 -m venv venv
-
Activate the virtual environment
source venv/bin/activate -
Install the required dependencies
on Linux:
pip install -r requirements.txt
on macOS:
pip install -r requirements-mac.txt
Note: this guide is written for
WSL2usingUbuntu 22.04 LTS (Jammy).
Show/Hide
Python 3.11 is not included in the default Ubuntu repository so we need to add a PPA in order to install. If you are using a different Ubuntu version you need to verify that Python 3.11 is provided here or use a different PPA.
- Add
deadsnakes PPAto the systemsudo add-apt-repository ppa:deadsnakes/ppa
- Update package list to ensure the new repository is included
sudo apt update
- Install Python 3.11 and tk dependencies
sudo apt install python3.11 python3-tk tk-dev
- Verify installation & base Python installation intact
python3 --version python3.11 --version
- Intall
venvfor Python 3.11sudo apt install python3.11-venv
- Navigate to the repository root folder in your terminal
cd /path/to/repository - Create a Python virtual environment
python3.11 -m venv venv
- Activate the virtual environment
source venv/bin/activate - Upgrade
pipinside the virtual environmentpip install --upgrade pip
- Install the required dependencies
pip install -r requirements.txt
In order to utilize the GPU for TensorFlow operations, additional setup is needed.
Show/Hide
Note: verify that you have the hardware & system requirements needed: TensorFlow website
Ensure that you have the latest Nvidia GPU drivers installed. Most cards with updated drivers should support CUDA: Nvidia website
Download the CUDA Toolkit 12.3.2 installer for x86 from the Nvidia website
Open WSL in terminal and navigate to the directory you saved the installer - run the following commands:
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.3.2/local_installers/cuda-repo-wsl-ubuntu-12-3-local_12.3.2-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-12-3-local_12.3.2-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-12-3-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-3Verify installation using the following command:
nvcc --versionIf the last command doesn't work, you need to add the CUDA Toolkit to the environment variables:
- Open the shell configuration in
nano(or any other editor)nano ~/.bashrc - Add the following lines to the end of the file (to keep your custom configurations separate)
export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
- Save the file and reload the shell configuration
source ~/.bashrc
- Verify that the
nvcccommand now worksnvcc --version
Note: for this step you need to create an Nvidia developer account (for free) to download the library.
Download cuDNN v8.9.7 (December 5th, 2023), for CUDA 12.x for Ubuntu x86 from the Nvidia website.
Open WSL in terminal and navigate to the directory you saved the installer - run the following commands:
- Install the local repository
sudo dpkg -i cudnn-local-repo-ubuntu2204-8.9.7.29_1.0-1_amd64.deb
Note: if you get the message about the
keyring, copy the command from the output and run it in the terminal before proceeding with the next step. - Update package list
sudo apt update
- Install the
cuDNNlibrarysudo apt install -y libcudnn8
- Verify installation success
Note: you should see output similar to:
dpkg -l | grep libcudnnii libcudnn8 8.9.7.29-1+cuda12.2 amd64 cuDNN runtime libraries
- Navigate to the repository root folder in your terminal
cd /path/to/repository - Activate the virtual environment
source venv/bin/activate - Run the GPU test script
python3.11 dev_utils/test_gpu.py
Note: TensorFlow will silently default to using the CPU. If you suspect that your GPU is not being utilized you can enable explicit device logging by editing the script and changing the parameter in the following line to
True:
tf.debugging.set_log_device_placement(False)