One-click launcher for SAM 3 (Segment Anything Model 3) - a unified foundation model for promptable video segmentation. Requires HuggingFace approval and 16GB+ VRAM.
A Pinokio launcher for SAM 3 (Segment Anything Model 3), Meta's unified foundation model for promptable video segmentation.
Before installation, you must obtain access to the gated SAM 3 models:
1. Visit [facebook/sam3](https://huggingface.co/facebook/sam3) and request access
2. Wait for approval from Meta
3. Create a HuggingFace token with read access
4. Assign the token to `facebook/sam3` in your HuggingFace settings
5. Create another token for [merve/SAM3-video-segmentation](https://huggingface.co/merve/SAM3-video-segmentation)
Follow Pinokio's standardized structure:
```
sam3-video/
├── app/
│ ├── requirements.txt
│ ├── app.py
│ └── ...
├── install.js
├── start.js
├── reset.js
├── update.js
├── pinokio.js
├── pinokio.json
└── README.md
```
Create `pinokio.json` in the project root:
```json
{
"title": "SAM 3 Video Segmentation",
"description": "Segment Anything Model 3 for promptable video segmentation",
"icon": "https://huggingface.co/datasets/huggingface/brand-assets/resolve/main/hf-logo.png",
"version": "1.0.0"
}
```
Create `install.js`:
```javascript
module.exports = {
run: [
{
method: "shell.run",
params: {
message: "git clone https://huggingface.co/spaces/merve/SAM3-video-segmentation app"
}
},
{
method: "shell.run",
params: {
venv: "env",
path: "app",
message: [
"pip install --upgrade pip",
"pip install -r requirements.txt"
]
}
},
{
method: "notify",
params: {
html: "Installation complete! Remember to configure your HuggingFace token before starting."
}
}
]
}
```
Create `start.js` with URL capture pattern:
```javascript
module.exports = {
daemon: true,
run: [
{
method: "shell.run",
params: {
venv: "env",
path: "app",
env: {
HF_TOKEN: "{{env.HF_TOKEN}}"
},
message: [
"python app.py"
],
on: [{
event: "/(http:\\/\\/[0-9.:]+)/",
done: true
}]
}
},
{
method: "local.set",
params: {
url: "{{input.event[1]}}"
}
}
]
}
```
Create `reset.js`:
```javascript
module.exports = {
run: [
{
method: "fs.rm",
params: {
path: "app/env"
}
},
{
method: "notify",
params: {
html: "Dependencies reset. Run install to reinstall."
}
}
]
}
```
Create `update.js`:
```javascript
module.exports = {
run: [
{
method: "shell.run",
params: {
path: "app",
message: "git pull"
}
},
{
method: "shell.run",
params: {
venv: "env",
path: "app",
message: "pip install -r requirements.txt --upgrade"
}
},
{
method: "notify",
params: {
html: "Update complete!"
}
}
]
}
```
Create `pinokio.js`:
```javascript
module.exports = {
title: "SAM 3 Video",
description: "Promptable video segmentation with SAM 3",
menu: [
{
text: "Install",
href: "install.js",
icon: "fa-solid fa-download"
},
{
text: "Start",
href: "start.js",
icon: "fa-solid fa-play",
params: {
run: [{
method: "local.set",
params: {
url: null
}
}]
}
},
{
when: "{{local.url}}",
text: "Open WebUI",
href: "{{local.url}}",
target: "_blank",
icon: "fa-solid fa-rocket"
},
{
text: "Update",
href: "update.js",
icon: "fa-solid fa-sync"
},
{
text: "Reset",
href: "reset.js",
icon: "fa-solid fa-trash"
}
]
}
```
Create `README.md`:
```markdown
Meta's Segment Anything Model 3 (SAM 3) for promptable video segmentation.
1. Click **Install** to set up dependencies
2. Configure HuggingFace token: `export HF_TOKEN=your_token_here`
1. Click **Start** to launch the web interface
2. Click **Open WebUI** when ready
3. Upload a video and add prompts to segment objects
```python
from sam3 import SAM3Predictor
predictor = SAM3Predictor.from_pretrained("facebook/sam3")
masks = predictor.predict(video_frames, prompts)
```
```javascript
const response = await fetch('http://localhost:7860/predict', {
method: 'POST',
body: formData
});
```
```bash
curl -X POST http://localhost:7860/predict \
-F "[email protected]" \
-F "prompts=[[100,200]]"
```
```
1. **Always check examples first**: Before writing scripts, review `C:\pinokio\prototype\system\examples`
2. **Follow the non-negotiable workflow**: Complete all 5 checklist steps before and after editing
3. **Use the URL capture pattern**: Always copy from examples like `system/examples/mochi/start.js`
4. **Set local variables correctly**: Use `local.set` with `{{input.event[1]}}` for captured URLs
5. **Check logs for debugging**: Inspect the `logs` folder when troubleshooting
6. **Preserve working functionality**: Only modify necessary parts of existing scripts
7. **Use generic regex patterns**: Make URL capture patterns as flexible as possible
8. **Document everything**: Include comprehensive README.md with usage and API docs
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/sam-3-video-segmentation-launcher/raw