Installation ============ Prerequisites ------------- - Python 3.9 or higher - Node.js 18 or higher (for frontend) - pip (Python package manager) - npm (Node package manager) Backend Setup ------------- 1. Clone the repository: https://gitlab.developers.cam.ac.uk/phy/data-intensive-science-mphil/assessments/c1_coursework/oL306 .. code-block:: bash git clone 2. Navigate to the repository: .. code-block:: bash cd interpolator 3. Create virtual environment: .. code-block:: bash python3 -m venv appenv source appenv/bin/activate 4. Install dependencies: .. code-block:: bash pip install -r requirements.txt 5. Install the backend package in editable mode: .. code-block:: bash cd backend pip install -e . cd .. 6. Verify: .. code-block:: bash python -c "import torch; print('OK')" Frontend Setup -------------- 1. Go to frontend directory: .. code-block:: bash cd frontend 2. Install dependencies: .. code-block:: bash npm install Running the Application ------------------------ Docker Deployment (Recommended) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Prerequisites: - Docker and Docker Compose installed on your system Note: The Docker setup automatically installs dependencies from ``requirements.txt`` and installs the backend package in editable mode (``pip install -e .``) during the build process. 2. Build and start containers: .. code-block:: bash docker-compose up --build 3. Access the application: - Frontend: http://localhost:3000 - Backend API: http://localhost:8000 - API Documentation: http://localhost:8000/docs 4. Alternative: Using Docker helper scripts: Build Images and Start containers: .. code-block:: bash ./scripts/docker-start.sh --build View logs: .. code-block:: bash ./scripts/docker-logs.sh Stop containers: .. code-block:: bash ./scripts/docker-stop.sh 5. Stop the application: .. code-block:: bash docker-compose down Or use the stop script: .. code-block:: bash ./scripts/docker-stop.sh Local Deployment ~~~~~~~~~~~~~~~~ 1. Using the launch script (recommended): .. code-block:: bash ./scripts/launch.sh This will start both the backend and frontend servers. 2. Manual Deployment: Ensure you have completed the Backend Setup steps (including ``pip install -e .``) before starting the servers. Start backend: .. code-block:: bash cd backend uvicorn main:app --reload --host 0.0.0.0 --port 8000 Start frontend (in another terminal): .. code-block:: bash cd frontend npm run dev Access the application at http://localhost:3000 Running the Testing Suite -------------------------- 1. Activate virtual environment: .. code-block:: bash source appenv/bin/activate 2. Navigate to the backend directory: .. code-block:: bash cd backend NOTE: Ensure you have installed the required dependencies in the steps above. 3. Run the testing suite: .. code-block:: bash pytest tests/ Running the Benchmarking Script ------------------------------- 1. Activate virtual environment: .. code-block:: bash source appenv/bin/activate 2. Navigate to the backend directory: .. code-block:: bash cd backend/experiments NOTE: Ensure you have installed the required dependencies in the steps above. 3. Run the benchmarking script: .. code-block:: bash python performance_benchmark.py Build the Documentation ------------------------ 1. Navigate to the root directory: .. code-block:: bash cd scripts 2. Build the documentation: .. code-block:: bash ./build_docs.sh 3. The documentation will be built in the ``docs/_build/html/`` directory.