This repository contains the source code for dl.web.js, a platform for federated learning on the browser.
- Web app: https://dlonweb.netlify.app/
- Documentation and project details : https://shubhvjain.github.io/dlonweb/
- Simply go to https://dlonweb.netlify.app
- Upload your input, select a model and get the output - as simple as that!
- The inputs you upload stay on your browser
- You can easily do that as well or just run it on your local machine
- We provide a docker file for easy build and deployment of all app components
Due to resource constraints on the browser, we also provide a standalone backend service accessible via HTTP. It enables additional functionalities like converting Keras models for browser compatible inference
-
Step 1: Ensure that Docker is installed on your local machine. You can find installation instructions here.
-
Step 2: Clone the GitHub repository. This will download the latest code for the backend server from GitHub.
- Command:
git clone -b release https://github.com/shubhvjain/dlonweb.git
- Command:
-
Step 3: Open a terminal and navigate to the project's root directory.
-
Step 4: Run the Docker Compose command.
- The
docker-compose.ymlfile in the root directory can be used to start both the frontend and backend services. - To run only the backend, use:
docker compose up backend - To run both the frontend and backend, use:
docker compose up
- The
-
Step 5: The backend server runs by default on port 3000. Make sure to specify this URL in your frontend configuration.
The project is divided into 3 main sub folders.
- The shared JS npm package with core abstract base classes for loading data , training the model and performing an inference task.
- It is used as a local dependency in the frontend and backend packages and enables consistent behavior across the browser and server environment.
- It is integrated using dependency injection allowing frontend and backend to plug in platform specific dependencies to avoid duplicate logic. For instance, using
@tensorflow/tfjspackage in the frontend and@tensorflow/tfjs-nodein the backend to use Tensorflow. - See the README file for more details
- Web-based user interface.
- The main app.
- Build using the Svelte framework.
- Styling using Bootstrap 5
- See the README file for more details
- Node.js backend with Python (Poetry) component.
- This serves and an additional,optional standalone service that can increase the power of the frontend. Needs to be run on a local port and is accessed via http from the frontend.
- See the README file for more details
install.sh: Script to install all the whole project on a local computer. See the installation section for more detailsdocs: this folder contains documentation files along with some demo input and output databackend.Dockerfile: the docker file for backendcompose.yml: The docker compose file for the projectfrontend.Dockerfile: the docker file for frontendfrontend.nginx.conf: the nginx config file used in the docker container to serve frontendnetlify.toml: the configuration file for deploying frontend on netlify
Step to get the system running locally
- Dependencies
- Clone the repository :
git clone https://github.com/shubhvjain/dlonweb1.git dlonweb cd dlonweb- Install all required dependencies: There are 2 possible options here.
- Install all dependencies at once using
install.shscript. Run./install.shfrom the root of the project - Individual components installations:
core:cd core && npm installfrontend:cd frontend && npm installbackend:cd backend && npm install. additionally, backend also depends on python, which m
- Install all dependencies at once using
- This can be done by installing each package individually. Or run
install.shscript which will install all dependencies
- All current development happens on the
mainbranch - The current release version is on the
releasebranch - For new development, create a feature branch from
mainand create a PR tomain - To release a new version : create a PR from
maintorelease