Skip to Content
DocumentationWeb interface

Web interface

mllabiome ships with an optional web application for model inference, federated learning coordination, and training analytics. The application consists of a FastAPI backend and a Next.js frontend.

Installation

Install the app dependencies:

uv pip install -e ".[app]"

Install the frontend dependencies:

cd app/frontend npm install

Starting the application

Backend

python app/run_backend.py

The backend starts on port 8000 by default. Use --port and --host to customise:

python app/run_backend.py --port 9000 --host 127.0.0.1

The interactive API documentation is available at http://localhost:8000/docs (Swagger UI).

Frontend

In a separate terminal:

cd app/frontend npm run dev

The frontend starts on port 3000. Open http://localhost:3000 in a browser.

Operating modes

The landing page presents three operating modes:

ModePortDescription
Server admin3000Federated learning dashboard. Manage clients, create training sessions, view analytics.
Client node3001-3008Client-side interface. Load local data, review training proposals, submit consent. Each port maps to a hospital identifier (3001 = Hospital_1, 3002 = Hospital_2, etc.).
Inference3000Upload samples, select a deployed model, receive predictions with optional LIME explanations.

Configuration

Backend settings are loaded from environment variables or a .env file in the backend directory.

VariableDefaultDescription
EXPERIMENT_DIRNoneBase experiment directory for model discovery
CORS_EXTRA_ORIGINS""Comma-separated additional CORS origins
MAX_UPLOAD_SIZE10 MBMaximum file upload size
ENABLE_FEDERATEDtrueEnable the federated learning endpoints
MAX_CLIENTS100Maximum simultaneous federated clients
ENABLE_ANALYTICStrueEnable the analytics engine

Frontend settings are configured through environment variables prefixed with NEXT_PUBLIC_:

VariableDefaultDescription
NEXT_PUBLIC_API_URLhttp://localhost:8000Backend API base URL
NEXT_PUBLIC_WS_URLws://localhost:8000WebSocket URL for real-time updates

API route groups

The backend registers the following route groups under /api:

GroupPrefixDescription
Health/api/healthLiveness check
Inference/api/inferenceModel predictions and LIME explanations
Training/api/trainingSession creation, consent, execution
Clients/api/clientsClient registration, heartbeat, status
Client data/api/clients/{id}/trainingClient training status and Flower connection
Analytics/api/analyticsFederated training metrics and convergence
Data/api/dataFile download for clients
Chat/api/chatLLM-powered microbiome analysis (requires Ollama)
Research/api/researchDisease task definitions and evaluation

Frontend components

ComponentPurpose
FLDashboardServer admin panel for client monitoring, training session control, and analytics display
FederatedClientClient node UI for local data loading, proposal review, and consent submission
InferenceInterfaceModel selection, file upload, prediction results, and LIME explanation requests
ChatInterfaceConversational interface for microbiome analysis (connects to Ollama)
CompactAnalyticsSummary statistics for connected clients and training progress
AnalyticsVisualizationTraining curve and feature importance charts (built with Recharts)

Technology stack

LayerTechnology
BackendFastAPI, uvicorn, Pydantic
FrontendNext.js 14, React 18, TypeScript
ChartsRecharts
HTTP clientAxios (frontend), httpx (backend)
FederationFlower (flwr)
ExplanationsLIME
Last updated on