Quick Start: Running the Gradio Demo
A great way to get started with OVSAM is by running the interactive Gradio demo locally. This allows you to upload an image and interactively segment and recognize objects without needing to download large datasets or train a model from scratch.
Prerequisites
- A complete Installation.
git-lfs
installed on your system. You can install it via your system's package manager (e.g.,sudo apt-get install git-lfs
on Debian/Ubuntu).
Steps to Run the Demo
-
Initialize Git LFS: This is required to download the large model files hosted on Hugging Face.
git lfs install
-
Clone the Hugging Face Space Repository: The Gradio demo is hosted in a separate repository on Hugging Face. Clone it to your local machine.
git clone https://huggingface.co/spaces/HarborYuan/ovsam ovsam_demo cd ovsam_demo
-
Set Up the Python Environment: It's recommended to create a dedicated conda environment for the demo.
conda create -n ovsam_demo python=3.10 conda activate ovsam_demo
-
Install Demo-specific Dependencies: The demo requires
gradio
and a few other packages listed in itsrequirements.txt
file.python -m pip install gradio==4.7.1 python -m pip install -r requirements.txt
-
Launch the Demo: Run the main application script.
python main.py
After running the command, you will see a local URL in your terminal (e.g., http://127.0.0.1:7860
). Open this URL in your web browser to start using the Open-Vocabulary SAM demo.