Skip to content

Commit

Permalink
drop kmeans model into Label Studio, just for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
metazool committed Feb 13, 2025
1 parent 67bccc8 commit 5d97310
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ Application is in `src/label_studio_cyto_ml`

[Setup documentation](src/label_studio_cyto_ml/README.md)

Short version, for testing

```
cd src
label-studio-ml start ./label_studio_cyto_ml
```

## Pipelines

### DVC
Expand Down
4 changes: 2 additions & 2 deletions scripts/dvc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
stages:
index:
cmd: python image_metadata.py
# index:
# cmd: python image_metadata.py
embeddings:
cmd: python image_embeddings.py
#outs:
Expand Down
6 changes: 5 additions & 1 deletion src/label_studio_cyto_ml/model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pickle
from typing import Any, Dict, List, Literal, Optional

from label_studio_ml.model import LabelStudioMLBase
Expand Down Expand Up @@ -79,7 +80,10 @@ def embeddings_predict(self, embeddings: List[List[float]]) -> List[str]:
See cyto_ml/visualisation/pages/02_kmeans.py for usage for a collection
See scripts/cluster.py for the model build and save
"""
pass
# TODO load this from config, add to Dockerfile
fitted = pickle.load(open("../models/kmeans-untagged-images-lana.pkl", "rb"))
label = fitted.predict(embeddings)
return label

def fit(
self,
Expand Down

0 comments on commit 5d97310

Please sign in to comment.