SightLinks is a web application that provides image processing capabilities using machine learning models. This repository contains the frontend of the application built with React.
- Upload and process ZIP files containing images
- Track processing progress with real-time updates
- Download processed results
- Various image processing options
- API documentation and guides
- Algorithm explanation and guides
- GitHub setup instructions
- Node.js (v18.x or higher recommended)
- npm or yarn
-
Clone the repository:
git clone https://github.com/UCL-SightLinks/webapp-frontend.git cd webapp-frontend -
Install dependencies:
npm install
-
Set up environment variables: Create or modify the following files based on your environment:
.env- Base environment variables.env.development- Development-specific variables.env.production- Production-specific variables
Example
.env.development:CI=false GENERATE_SOURCEMAP=false REACT_APP_API_URL=/api
Start the development server:
npm startThe application will be available at http://localhost:3000.
Build the application for production:
npm run buildThe build artifacts will be stored in the build/ directory.
This application is configured for deployment to Azure Static Web Apps.
-
Set up your Azure Static Web App resource in Azure Portal.
-
Configure GitHub Actions for CI/CD by connecting your repository to Azure Static Web Apps.
-
Ensure your
staticwebapp.config.jsonis properly set up:{ "platform": { "apiRuntime": "node:18" }, "globalHeaders": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, PUT" }, "buildProperties": { "skipBuildDuringDeploy": false, "apiBuildCommand": "npm run build", "outputLocation": "build" }, "routes": [ { "route": "/*", "serve": "/index.html", "statusCode": 200 } ] } -
Push changes to your repository to trigger the deployment pipeline.
The application uses the following environment variables:
| Variable | Description | Default |
|---|---|---|
| REACT_APP_API_URL | Base URL for API calls | /api |
| CI | Disable CI environment for build | false |
| GENERATE_SOURCEMAP | Generate source maps | false |
| SKIP_PREFLIGHT_CHECK | Skip dependency checking | true |
| DISABLE_ESLINT_PLUGIN | Disable ESLint during build | true |
| INLINE_RUNTIME_CHUNK | Inline runtime chunk in HTML | false (for production) |
The API configuration can be found in src/pages/Processing.js. You can modify the API_CONFIG object to change the API endpoints:
const API_CONFIG = {
baseUrl: process.env.REACT_APP_API_URL || 'https://sightlinks.org/api',
endpoints: {
webPredict: '/web/predict',
status: '/web/status',
download: '/download',
cancel: '/web/cancel',
serverStatus: '/server-status'
}
};src/
├── components/ # Reusable UI components
├── pages/ # Application pages
│ ├── About.js # About page
│ ├── AlgorithmGuide.js # Algorithm documentation
│ ├── ApiDocs.js # API documentation
│ ├── Documentation.js # Main documentation
│ ├── GitHubSetup.js # GitHub setup guide
│ ├── Home.js # Home page
│ └── Processing.js # Main processing page
├── App.js # Main application component
├── index.js # Application entry point
└── theme.js # Material UI theme configuration
The application allows users to process images by:
- Uploading a ZIP file containing images
- Configuring processing parameters
- Submitting for processing
- Tracking processing progress
- Downloading results
Users can configure multiple parameters:
- Input type
- Classification threshold
- Prediction threshold
- Save labeled images option
- Output type
- YOLO model type
The frontend connects to a backend API that provides:
- Asynchronous processing with progress tracking
- Direct download of processed results
- Server status monitoring
For detailed API documentation, refer to the API.md file or visit the /api-docs page in the application.