# WSI Embed Client SDK

Pip-installable frontend/client package for sending a local slide to the backend and saving embedding results on the user's machine.

## 1) Install

```bash
cd frontend
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
```

Install from built wheel (recommended for remote client machines):

```bash
pip install squishy_wsi-0.1.0-py3-none-any.whl
```

## 2) Usage

### Python API

```python
from wsi_embed_client import embed

result = embed(
    slide_path="/path/to/slide.svs",
    model="titan-real-v1",
    key="team-key-123",
    server_url="http://your-gpu-server:8000",
)

print(result["embedding_id"])
print(result["saved_path"])
```

### CLI

After install, use:

```bash
wsi-embed /path/to/slide.svs \
  --model titan-real-v1 \
  --key team-key-123 \
  --server-url http://your-gpu-server:8000
```

Optional flags:
- `--output-dir /path/to/save`
- `--timeout-seconds 600`
- `--print-json`

## What `embed(...)` does

1. Zips the slide file locally.
2. Sends the zip to the backend with `X-API-Key`.
3. Receives embedding + metadata.
4. Saves a rich JSON object to `./embeddings/` by default.

Saved filename format:
- `<slide>__<model>__<timestamp>__<shortid>.embedding.json`

## Supported model (validated)

The end-to-end path that is tested and validated is:

- `titan-real-v1`

This corresponds to backend processing using TRIDENT patching + CONCH v1.5 patch features + TITAN slide aggregation.

## 3) Test

```bash
pytest -q
```
