A simple web application integrating the Segment Anything Model (SAM) for efficient image segmentation. This project includes a Python-based backend and a React-powered frontend.
- Backend: Python >= 3.10
- Frontend: Node.js >= 14.x and npm or yarn
Ensure you have these installed on your system before proceeding.
-
Clone the repository:
git clone https://github.com/diegopereyra99/sam-webapp.git cd sam-webapp/backend -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Run the backend API:
uvicorn main:app --port 8000
The backend should now be running at http://localhost:8000.
-
Navigate to the frontend directory:
cd ../frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
The frontend should be accessible at http://localhost:3000.
-
Start the backend as described in the Backend Setup section.
- If running in a more powerful instance, forward the backend to
localhost:8000using SSH or port forwarding (the frontend hits the API there).
- If running in a more powerful instance, forward the backend to
-
Start the frontend as described in the Frontend Setup section.
-
Access the web app at
http://localhost:3000.
Upload an image through the frontend interface, and for each click the SAM mask will be generated connecting to the backend and displayed in the webapp. Each mask can be hold to combine and overlap them, once finished it can be saved.
