Skip to content

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.

License

Notifications You must be signed in to change notification settings

diegopereyra99/sam-webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAM WebApp

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.

Prerequisites

  • Backend: Python >= 3.10
  • Frontend: Node.js >= 14.x and npm or yarn

Ensure you have these installed on your system before proceeding.


Installation and Setup

1. Backend Setup

  1. Clone the repository:

    git clone https://github.com/diegopereyra99/sam-webapp.git
    cd sam-webapp/backend
  2. Create a virtual environment and activate it:

    python -m venv venv
    source venv/bin/activate  # Linux/macOS
    venv\Scripts\activate   # Windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run the backend API:

    uvicorn main:app --port 8000

The backend should now be running at http://localhost:8000.


2. Frontend Setup

  1. Navigate to the frontend directory:

    cd ../frontend
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm start

The frontend should be accessible at http://localhost:3000.


Running the Application

  1. Start the backend as described in the Backend Setup section.

    • If running in a more powerful instance, forward the backend to localhost:8000 using SSH or port forwarding (the frontend hits the API there).
  2. Start the frontend as described in the Frontend Setup section.

  3. Access the web app at http://localhost:3000.


Usage

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.


Acknowledgements

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages