sam3-cpu / README.md
Benji Peng
update
3adcd63
---
title: sam3-gradio-cpu
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.3.0
python_version: 3.12
app_file: app.py
suggested_hardware: cpu-basic
pinned: false
---
# SAM3 Gradio (CPU-only)
This Space is configured for CPU-only usage. The Gradio app lives in `app.py`.
## Model access (HF token)
`facebook/sam3` is gated. On Hugging Face Spaces, add a Space secret named `HF_TOKEN` (or `HUGGINGFACE_HUB_TOKEN`) with a token that has accepted the model terms.
Local setup (from this folder):
```bash
python -m venv .venv
source .venv/bin/activate
python -m ensurepip --upgrade
python -m pip install -r requirements.txt
python app.py
```
## API usage
Gradio exposes HTTP endpoints for event handlers. The easiest client is `gradio_client`:
```bash
python examples/call_space_gradio_client.py --space https://tamarher-sam3-cpu.hf.space --image-url https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png --prompt bus
```
If you prefer `requests`, use the `/gradio_api/call/...` SSE endpoint:
```bash
python examples/call_space_requests.py --base https://tamarher-sam3-cpu.hf.space --image-url https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png --prompt bus
```