Project Setup Guide
Overview
A Machine Learning Models Builder and Manager built with Laravel, Livewire, Tensorflow and FastAPI, providing a set of features:
- A login system.
- The capability to create, manage, and utilize multiple datasets.
- The ability to train diverse models associated with various datasets asynchronously.
- Real-time notifications for ongoing model training or readiness for use.
- Instant notifications upon results becoming available.
- Comprehensive logs that showcase received results, along with search, filter, and deletion functionalities
Manual Setup
You can avoid this configurational step by using the Docker installation process.
Before setting up the project, make sure you have the required dependencies:
- Python >= 3.10
- PHP >= 8.1
- pip
- composer
- npm
Installing Dependencies
The following example works for Debian Based Linux Distributions.
Update the system
sudo apt update && sudo apt upgrade -y
Install Python
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10
Install pip
sudo apt install python3-pip
Install PHP
sudo apt get install -y php8.1-cli php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath
Install composer
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
Install npm
sudo apt install nodejs npm
Setting the Web Application
Make sure you are in the web-app
directory
cd src/web-app
Install composer dependencies
composer install
Install npm dependencies and build the assets
npm install
npm run build
Create the .env
file and generate the application encryption key
cp .env.example .env
php artisan key:generate
Update the package.json
file by swapping the scripts
section with the one below
"scripts": {
"dev": "vite",
"build": "vite build"
},
Setting the Model
Install all the requirements
pip install --no-cache-dir --upgrade -r dockerfiles/ml-model/requirements.txt
Running the project
Start the model
cd src/ml-model
uvicorn home:app --host 127.0.0.1 --port 5000 --reload
Start the built-in web server
cd src/web-app
php artisan serve
You can now access the server at http://localhost:8000.
Docker Setup
Make sure Docker is installed.
If you are using a Windows 10/11, you need to know that Windows uses WSL (Windows Subsystem for Linux), which is a layer between Windows and Linux, this makes Docker slow and browser requests may take 30-60 seconds to be completed.
Spin up the containers
docker-compose up -d --build app
Running the command will expose 3 services with the following ports:
- Nginx -
:80
- PHP -
:9000
- FastAPI -
:5500
Install composer dependencies
docker-compose run --rm composer install
Install npm dependencies and build the assets
docker-compose run --rm npm install
docker-compose run --rm --service-ports npm run build
Create the .env
file and generate the application encryption key
cp .env.example .env
docker-compose run --rm php artisan key:generate
You can now access the server at http://localhost.