This repository contains code for deploying a Gradio application using the SAM2 model for video processing. The application allows users to interact with the model through a user-friendly web interface.
To set up the project locally, follow these steps:
-
Clone the GitHub repository:
git clone https://github.com/sujanshresstha/sam2-in-video.git cd sam2-in-video
-
Install the necessary dependencies:
pip install -e . pip install -q -r requirements.txt
-
Build the project:
python setup.py build_ext --inplace
-
Download the necessary model checkpoints:
cd checkpoints ./download_ckpts.sh cd ..
To run the Gradio application:
- Make sure you are in the root directory of the cloned repository.
- Run the
gradio_app.py
script:python gradio_app.py
This will launch the Gradio interface, where you can interact with the SAM2 model.
Alternatively, you can run the entire setup and launch the Gradio app through the provided Jupyter Notebook:
- Open the
gradio_app.ipynb
file in Jupyter Notebook or JupyterLab. - Execute the cells sequentially to set up the environment and launch the app.
gradio_app.ipynb
: A Jupyter Notebook containing steps to set up the environment and run the Gradio application.gradio_app.py
: A Python script that contains the Gradio interface and the necessary backend logic for model inference.
This project requires the following dependencies:
- Python 3.7 or higher
- PyTorch
- Gradio
- OpenCV
- Matplotlib
- PIL