imaging-server-kit 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- imaging_server_kit-0.0.1/.dockerignore +4 -0
- imaging_server_kit-0.0.1/.github/workflows/publish.yml +27 -0
- imaging_server_kit-0.0.1/.gitignore +87 -0
- imaging_server_kit-0.0.1/Dockerfile +11 -0
- imaging_server_kit-0.0.1/Dockerfile-3.10 +11 -0
- imaging_server_kit-0.0.1/Dockerfile-GPU +11 -0
- imaging_server_kit-0.0.1/LICENSE +27 -0
- imaging_server_kit-0.0.1/MANIFEST.in +5 -0
- imaging_server_kit-0.0.1/PKG-INFO +144 -0
- imaging_server_kit-0.0.1/README.md +91 -0
- imaging_server_kit-0.0.1/examples/example.py +35 -0
- imaging_server_kit-0.0.1/main.py +4 -0
- imaging_server_kit-0.0.1/pyproject.toml +50 -0
- imaging_server_kit-0.0.1/reference_deployment/LICENSE +27 -0
- imaging_server_kit-0.0.1/reference_deployment/README.md +48 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/README.md +2 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/cookiecutter.json +5 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/requirements.txt +1 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/Dockerfile +5 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/README.md +6 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/main.py +72 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/requirements.txt +1 -0
- imaging_server_kit-0.0.1/reference_deployment/cookiecutter_template/serverkit-{{ cookiecutter.package }}/sample_images/blobs.tif +0 -0
- imaging_server_kit-0.0.1/reference_deployment/docker-compose.yml +14 -0
- imaging_server_kit-0.0.1/reference_deployment/registry/Dockerfile +3 -0
- imaging_server_kit-0.0.1/reference_deployment/registry/main.py +4 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/Dockerfile +5 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/README.md +6 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/main.py +141 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/requirements.txt +1 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/sample_images/blobs.tif +0 -0
- imaging_server_kit-0.0.1/reference_deployment/servers/serverkit-skimage/tests/test_skimage.py +26 -0
- imaging_server_kit-0.0.1/setup.cfg +4 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/__init__.py +8 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/_version.py +16 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/client.py +116 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/encoding.py +29 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/registry.py +73 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/serialization.py +49 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit/server.py +97 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/PKG-INFO +144 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/SOURCES.txt +43 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/dependency_links.txt +1 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/requires.txt +6 -0
- imaging_server_kit-0.0.1/src/imaging_server_kit.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Build the package and publish it to PyPI on tag push.
|
|
2
|
+
name: Publish to PyPI
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: publish
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout source
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.x"
|
|
19
|
+
- name: Build package
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install -U pip build
|
|
22
|
+
python -m build
|
|
23
|
+
- name: Publish
|
|
24
|
+
uses: pypa/gh-action-pypi-publish@v1.5.0
|
|
25
|
+
with:
|
|
26
|
+
user: __token__
|
|
27
|
+
password: ${{ secrets.TWINE_API_KEY }}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.napari_cache
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
|
|
57
|
+
# Flask instance folder
|
|
58
|
+
instance/
|
|
59
|
+
|
|
60
|
+
# Sphinx documentation
|
|
61
|
+
docs/_build/
|
|
62
|
+
|
|
63
|
+
# MkDocs documentation
|
|
64
|
+
/site/
|
|
65
|
+
|
|
66
|
+
# PyBuilder
|
|
67
|
+
target/
|
|
68
|
+
|
|
69
|
+
# Pycharm and VSCode
|
|
70
|
+
.idea/
|
|
71
|
+
venv/
|
|
72
|
+
.vscode/
|
|
73
|
+
|
|
74
|
+
# IPython Notebook
|
|
75
|
+
.ipynb_checkpoints
|
|
76
|
+
|
|
77
|
+
# pyenv
|
|
78
|
+
.python-version
|
|
79
|
+
|
|
80
|
+
# OS
|
|
81
|
+
.DS_Store
|
|
82
|
+
|
|
83
|
+
# written by setuptools_scm
|
|
84
|
+
**/_version.py
|
|
85
|
+
|
|
86
|
+
old/
|
|
87
|
+
data/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
FROM cschranz/gpu-jupyter:v1.6_cuda-12.0_ubuntu-22.04_python-only
|
|
2
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
3
|
+
USER root
|
|
4
|
+
|
|
5
|
+
COPY . .
|
|
6
|
+
|
|
7
|
+
RUN python -m pip install -e .
|
|
8
|
+
|
|
9
|
+
EXPOSE 8000
|
|
10
|
+
|
|
11
|
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--timeout-keep-alive", "300"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2024, EPFL
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of copyright holder nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: imaging-server-kit
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Run image processing algorithms in a FastAPI server.
|
|
5
|
+
Author-email: Mallory Wittwer <mallory.wittwer@epfl.ch>
|
|
6
|
+
License: Copyright (c) 2024, EPFL
|
|
7
|
+
All rights reserved.
|
|
8
|
+
|
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
|
10
|
+
modification, are permitted provided that the following conditions are met:
|
|
11
|
+
|
|
12
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
13
|
+
list of conditions and the following disclaimer.
|
|
14
|
+
|
|
15
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
16
|
+
this list of conditions and the following disclaimer in the documentation
|
|
17
|
+
and/or other materials provided with the distribution.
|
|
18
|
+
|
|
19
|
+
* Neither the name of copyright holder nor the names of its
|
|
20
|
+
contributors may be used to endorse or promote products derived from
|
|
21
|
+
this software without specific prior written permission.
|
|
22
|
+
|
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
24
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
25
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
26
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
27
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
28
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
29
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
30
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
31
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
32
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
33
|
+
|
|
34
|
+
Project-URL: homepage, https://gitlab.com/epfl-center-for-imaging/imaging-server-kit
|
|
35
|
+
Project-URL: repository, https://gitlab.com/epfl-center-for-imaging/imaging-server-kit
|
|
36
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
37
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
43
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
44
|
+
Requires-Python: >=3.9
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
Requires-Dist: fastapi
|
|
48
|
+
Requires-Dist: uvicorn[standard]
|
|
49
|
+
Requires-Dist: python-multipart
|
|
50
|
+
Requires-Dist: tifffile
|
|
51
|
+
Requires-Dist: numpy
|
|
52
|
+
Requires-Dist: scikit-image
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
# 🪐 Imaging Server Kit
|
|
56
|
+
|
|
57
|
+
Run seamlessly interoperable algorithms on images using FastAPI.
|
|
58
|
+
|
|
59
|
+
## Setup
|
|
60
|
+
|
|
61
|
+
Build the `imaging-server-kit` image with `docker`:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
docker build -t imaging-server-kit:3.9 .
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
or build specific images:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
docker build -t imaging-server-kit:3.10 --file Dockerfile-3.10 .
|
|
71
|
+
docker build -t imaging-server-kit:gpu --file Dockerfile-GPU .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Run an algorithm server**
|
|
75
|
+
|
|
76
|
+
The server will be running on `http://localhost:8000`.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
docker build -t serverkit/rembg .
|
|
80
|
+
docker run -it --rm -p 8000:8000 serverkit/rembg
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Run an algorithm server with multiple algorithms**
|
|
84
|
+
|
|
85
|
+
See [deployment](./reference_deployment/README.md). The server will be running on `http://localhost:7000`.
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
**Python client**
|
|
90
|
+
|
|
91
|
+
Install the `imaging-server-kit` package with `pip`:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
pip install git+https://gitlab.com/epfl-center-for-imaging/imaging-server-kit.git
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Connect to an algorithm server and run algorithms from Python:
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from imaging_server_kit import Client
|
|
101
|
+
|
|
102
|
+
client = Client()
|
|
103
|
+
|
|
104
|
+
client.connect("http://localhost:7000")
|
|
105
|
+
|
|
106
|
+
print(client.algorithms)
|
|
107
|
+
# [`rembg`, `stardist`, `sam2`]
|
|
108
|
+
|
|
109
|
+
data_tuple = client.run_algorithm(
|
|
110
|
+
algorithm="rembg",
|
|
111
|
+
image=(...),
|
|
112
|
+
rembg_model_name="silueta",
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
More [examples](./examples/).
|
|
117
|
+
|
|
118
|
+
**Napari client**
|
|
119
|
+
|
|
120
|
+
Coming soon.
|
|
121
|
+
|
|
122
|
+
**Web client**
|
|
123
|
+
|
|
124
|
+
Coming soon.
|
|
125
|
+
|
|
126
|
+
**QuPath client**
|
|
127
|
+
|
|
128
|
+
Coming soon.
|
|
129
|
+
|
|
130
|
+
**Fiji plugin**
|
|
131
|
+
|
|
132
|
+
Coming soon.
|
|
133
|
+
|
|
134
|
+
## Contributing
|
|
135
|
+
|
|
136
|
+
Contributions are very welcome.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
|
|
141
|
+
|
|
142
|
+
## Issues
|
|
143
|
+
|
|
144
|
+
If you encounter any problems, please file an issue along with a detailed description.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+

|
|
2
|
+
# 🪐 Imaging Server Kit
|
|
3
|
+
|
|
4
|
+
Run seamlessly interoperable algorithms on images using FastAPI.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
Build the `imaging-server-kit` image with `docker`:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
docker build -t imaging-server-kit:3.9 .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or build specific images:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
docker build -t imaging-server-kit:3.10 --file Dockerfile-3.10 .
|
|
18
|
+
docker build -t imaging-server-kit:gpu --file Dockerfile-GPU .
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
**Run an algorithm server**
|
|
22
|
+
|
|
23
|
+
The server will be running on `http://localhost:8000`.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
docker build -t serverkit/rembg .
|
|
27
|
+
docker run -it --rm -p 8000:8000 serverkit/rembg
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Run an algorithm server with multiple algorithms**
|
|
31
|
+
|
|
32
|
+
See [deployment](./reference_deployment/README.md). The server will be running on `http://localhost:7000`.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
**Python client**
|
|
37
|
+
|
|
38
|
+
Install the `imaging-server-kit` package with `pip`:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
pip install git+https://gitlab.com/epfl-center-for-imaging/imaging-server-kit.git
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Connect to an algorithm server and run algorithms from Python:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from imaging_server_kit import Client
|
|
48
|
+
|
|
49
|
+
client = Client()
|
|
50
|
+
|
|
51
|
+
client.connect("http://localhost:7000")
|
|
52
|
+
|
|
53
|
+
print(client.algorithms)
|
|
54
|
+
# [`rembg`, `stardist`, `sam2`]
|
|
55
|
+
|
|
56
|
+
data_tuple = client.run_algorithm(
|
|
57
|
+
algorithm="rembg",
|
|
58
|
+
image=(...),
|
|
59
|
+
rembg_model_name="silueta",
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
More [examples](./examples/).
|
|
64
|
+
|
|
65
|
+
**Napari client**
|
|
66
|
+
|
|
67
|
+
Coming soon.
|
|
68
|
+
|
|
69
|
+
**Web client**
|
|
70
|
+
|
|
71
|
+
Coming soon.
|
|
72
|
+
|
|
73
|
+
**QuPath client**
|
|
74
|
+
|
|
75
|
+
Coming soon.
|
|
76
|
+
|
|
77
|
+
**Fiji plugin**
|
|
78
|
+
|
|
79
|
+
Coming soon.
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
Contributions are very welcome.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
This software is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
|
|
88
|
+
|
|
89
|
+
## Issues
|
|
90
|
+
|
|
91
|
+
If you encounter any problems, please file an issue along with a detailed description.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Demo: Running an algorithm.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import imaging_server_kit as serverkit
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
client = serverkit.Client()
|
|
10
|
+
status_code = client.connect("http://localhost:7000")
|
|
11
|
+
print(f"{status_code=}")
|
|
12
|
+
print(f"{client.algorithms=}")
|
|
13
|
+
|
|
14
|
+
algo = client.algorithms[0] # e.g. `rembg`
|
|
15
|
+
|
|
16
|
+
# Get the algo params
|
|
17
|
+
rembg_params = client.get_algorithm_parameters(algo)
|
|
18
|
+
print(f"{rembg_params=}")
|
|
19
|
+
|
|
20
|
+
# Get the algo sample image
|
|
21
|
+
rembg_sample_images = client.get_sample_images(algo)
|
|
22
|
+
for image in rembg_sample_images:
|
|
23
|
+
print(f"{image.shape=}")
|
|
24
|
+
sample_image = rembg_sample_images[0]
|
|
25
|
+
|
|
26
|
+
# Run the algo (return type is a `LayerDataTuple`)
|
|
27
|
+
algo_output = client.run_algorithm(
|
|
28
|
+
algorithm=algo, image=sample_image, rembg_model_name="silueta"
|
|
29
|
+
)
|
|
30
|
+
for data, data_params, data_type in algo_output:
|
|
31
|
+
print(f"Algo returned: {data_type=} ({data.shape=})")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
main()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "imaging-server-kit"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Run image processing algorithms in a FastAPI server."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
license = { file = "LICENSE" }
|
|
8
|
+
authors = [{ name = "Mallory Wittwer", email = "mallory.wittwer@epfl.ch" }]
|
|
9
|
+
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
12
|
+
"License :: OSI Approved :: BSD License",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.9",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Image Processing",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
dependencies = [
|
|
22
|
+
"fastapi",
|
|
23
|
+
"uvicorn[standard]",
|
|
24
|
+
"python-multipart",
|
|
25
|
+
"tifffile",
|
|
26
|
+
"numpy",
|
|
27
|
+
"scikit-image",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
homepage = "https://gitlab.com/epfl-center-for-imaging/imaging-server-kit"
|
|
32
|
+
repository = "https://gitlab.com/epfl-center-for-imaging/imaging-server-kit"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["setuptools>=42.0.0", "wheel", "setuptools_scm"]
|
|
36
|
+
build-backend = "setuptools.build_meta"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools]
|
|
39
|
+
include-package-data = true
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.packages.find]
|
|
42
|
+
where = ["src"]
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.package-data]
|
|
45
|
+
"*" = ["*.yaml"]
|
|
46
|
+
|
|
47
|
+
[tool.setuptools_scm]
|
|
48
|
+
write_to = "src/imaging_server_kit/_version.py"
|
|
49
|
+
version_scheme = "guess-next-dev"
|
|
50
|
+
local_scheme = "no-local-version"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2024, EPFL
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of copyright holder nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+

|
|
2
|
+
# 🪐 Deployment
|
|
3
|
+
|
|
4
|
+
Start the server:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
docker compose up -d
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
**Add a new algorithm**
|
|
11
|
+
|
|
12
|
+
Start from the template:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
cookiecutter cookiecutter_template/
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Edit the `Parameters` and `Server` in your `main.py` to your liking.
|
|
19
|
+
|
|
20
|
+
Move your `serverkit-my-algo` folder to `./servers`.
|
|
21
|
+
|
|
22
|
+
Add an entry to `docker-compose.yml`:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
my-algo:
|
|
26
|
+
build:
|
|
27
|
+
context: ./servers/serverkit-my-algo
|
|
28
|
+
depends_on:
|
|
29
|
+
- servers_registry
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Restart the server:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
docker compose restart
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Contributing
|
|
39
|
+
|
|
40
|
+
Contributions are very welcome.
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
This project is distributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license.
|
|
45
|
+
|
|
46
|
+
## Issues
|
|
47
|
+
|
|
48
|
+
If you encounter any problems, please file an issue along with a detailed description.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cookiecutter
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+

|
|
2
|
+
# {{ cookiecutter.package }} API in docker
|
|
3
|
+
|
|
4
|
+
Implementation of a web API server for [{{ cookiecutter.package }}]({{ cookiecutter.project_url }}).
|
|
5
|
+
|
|
6
|
+
Author: {{ cookiecutter.author }}
|