Add frontend and backend infrastructure for PA228 image segmentation project#2
Draft
Add frontend and backend infrastructure for PA228 image segmentation project#2
Conversation
Co-authored-by: borisim <71882964+borisim@users.noreply.github.com>
Co-authored-by: borisim <71882964+borisim@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Set up initial frontend for borisim/PA228 project
Add frontend and backend infrastructure for PA228 image segmentation project
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements a complete frontend solution for the PA228 image segmentation project, providing a modern web interface for model inference with a Flask backend API and React frontend application.
What's New
Backend API (
backend/)A Flask-based REST API that exposes the existing PyTorch segmentation model through HTTP endpoints:
Three RESTful endpoints:
GET /api/health- Check server and model statusGET /api/model/info- Get model configuration and class informationPOST /api/predict- Upload image and receive segmentation predictionFeatures:
inference.pyand model architectureFrontend Application (
frontend/)A modern React web interface built with Vite that provides an intuitive UI for image segmentation:
Components:
ImageUpload- Drag-and-drop file upload with visual feedback and file validationPredictionDisplay- Side-by-side comparison of original and segmented images with color-coded class legendModelInfo- Real-time backend connection status indicatorFeatures:
Documentation
Comprehensive documentation for both development and production use:
QUICKSTART.md- 5-minute setup guide for quick startREADME_FRONTEND.md- Complete project documentation covering architecture, deployment, and troubleshootingbackend/README.md- Backend API reference with endpoint specificationsfrontend/README.md- Frontend development guide with component documentationTechnology Stack
Quick Start
Start Backend
Start Frontend
cd frontend npm install npm run devOpen
http://localhost:5173and start segmenting images!Screenshot
The interface shows:
Configuration
Both backend and frontend are configurable through environment variables:
Backend (
backend/app.py):Frontend (
frontend/.env):Implementation Details
Minimal Changes
training.py,inference.py,network.py,dataset.py)backend/andfrontend/directories.gitignoreto exclude build artifacts (node_modules,dist, etc.)API Design
The backend API follows REST principles with proper error handling:
Frontend Architecture
React components are modular and reusable:
Testing
npm run build)Next Steps
This implementation provides a foundation for further development:
Dependencies
All dependencies are properly specified:
backend/requirements.txt(Flask, torch, albumentations, etc.)frontend/package.json(React, Vite, ESLint, etc.)No changes to existing project dependencies.
Resolves #[issue_number] - Create frontend for the project
Original prompt
Fixes #1
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.