Small self-hosted web application for uploading datasets, training classical and neural-network models, visualizing training progress, and inspecting experiments.
- Backend entry: backend/app.py — minimal runner that loads the app.
- HTTP endpoints and Socket.IO handlers: backend/endpoints.py.
- ML wrapper and model helpers:
ModelWrapper(backend/ml/wrapper.py). - DB models: backend/models.py.
- Shared extensions (db/socket/login): backend/extensions.py.
- Frontend: frontend/ (Vite + React + TypeScript).
- Frontend login/register pages: frontend/src/pages/login.tsx, frontend/src/pages/register.tsx.
- Training UI components: frontend/src/components/train-model-dialog.tsx, frontend/src/components/training-visualizer.tsx.
- Python 3.10+ (backend)
- Node 18+ / npm or pnpm (frontend)
- Packages listed in requirements.txt and frontend/package.json
- Create and activate a virtual environment and install dependencies:
# bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Run the backend (includes Socket.IO):
# bash
python app.pyThis will start the server on port 5050 by default. The Flask app and Socket.IO handlers are wired in backend/endpoints.py and extensions come from backend/extensions.py.
- Install dependencies and run dev server:
# bash
cd frontend
npm install
npm run dev- The frontend dev server (Vite) proxies /api to the backend using frontend/vite.config.ts.
- Frontend unit tests use Jest. From the
frontenddirectory:
# bash
cd frontend
npm test- There are no automated backend tests included by default.
- Dataset endpoints and upload are implemented in backend/endpoints.py (e.g.,
/api/upload,/api/datasets). - Model train endpoint (non-MLP streaming/non-streaming) is at
/api/train/<model_id>in backend/endpoints.py. For MLP streaming training the Socket.IO events (start_training,pause_training,resume_training,early_stop_training) are handled in the same file. - Model serialization and evaluation helper is
ModelWrapper.
- The code stores models and metadata in SQLite at
instance/app.db. Models are pickled into the DB viaModelWrapper.to_db_record. - Frontend components expect the backend API at
http://localhost:5050(see frontend/vite.config.ts proxy). - CORS is configured in the backend to allow the dev frontend origin (see backend/endpoints.py and backend/extensions.py).
- Large files are stored under
uploads/(configured viaapp.config['UPLOAD_FOLDER']in backend/endpoints.py).
- Add or modify endpoints in backend/endpoints.py or refactor into blueprints (recommended).
- Update ML logic in
ModelWrapperif adding new model types or metrics. - Edit UI behavior in the corresponding frontend component files under frontend/src/components/.
- To reset uploads and DB for a clean slate:
- Stop the backend.
- Remove
instance/app.dband contents ofuploads/. - Restart backend to recreate (some initialization logic runs on boot in backend/endpoints.py).
OR, send a POST request to the api/reset/both?key=supersecretresetkey endpoint
- Backend logs are printed to stdout when running
python backend/app.py. - The frontend dev server prints proxy activity (see frontend/vite.config.ts configure hooks).
- If Socket.IO connections fail in the browser, ensure the backend is reachable and
socket.io-clientversion matches server compatibility.
- Follow the existing code structure. Consider splitting large files (for example split backend/endpoints.py into blueprints) and reuse shared extensions in backend/extensions.py.