Skip to content

Commit a35b10e

Browse files
committed
gui: add pip/pipx/uvx support; fix docker in huggingface; fix ci
1 parent 0ba87ff commit a35b10e

File tree

6 files changed

+72
-20
lines changed

6 files changed

+72
-20
lines changed

.github/workflows/docker-build.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Docker
2+
3+
on:
4+
workflow_dispatch:
5+
6+
# jobs:
7+
# build:
8+
# runs-on: ubuntu-latest
9+
10+
# steps:
11+
# - name: Checkout code
12+
# uses: actions/checkout@v4
13+
14+
# - name: Set up Docker Buildx
15+
# uses: docker/setup-buildx-action@v2
16+
17+
# - name: Log in to DockerHub
18+
# uses: docker/login-action@v2
19+
# with:
20+
# username: ${{ secrets.DOCKER_USERNAME }}
21+
# password: ${{ secrets.DOCKER_PASSWORD }}
22+
23+
# - name: Build and push Docker image
24+
# uses: docker/build-push-action@v4
25+
# with:
26+
# context: ./gui/docker-compose
27+
# push: true
28+
# tags: ${{ secrets.DOCKER_USERNAME }}/hsi2rgb:latest

.github/workflows/uv-test.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
python-version: "3.12"
2121
- name: astral-sh/setup-uv
2222
uses: astral-sh/[email protected]
23-
- run: cd core
24-
- run: uv sync
25-
- run: uv build
26-
- run: uv run tests/test1.py
23+
- run: |
24+
cd core
25+
uv sync
26+
uv build
27+
uv run tests/test.py

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hsi2rgb.svg)](https://pypi.org/project/hsi2rgb)
88

99
Easily convert a hyperspectral image to an RGB image. hsi2rgb is:
10-
1. A python package that supports numpy, torch and jax, with gamma correction, automatically convertions, XYZ and RGB colorspace suppots, etc.
10+
1. A python package that easily integrates with numpy, torch and jax, with gamma correction, batch converting, automatically formats convertions, XYZ and RGB colorspace suppots, etc.
1111
2. A docker container that can be easily deployed as a GUI application
1212

1313
![ui-demo.jpg](asset/ui-demo.jpg)
@@ -26,28 +26,45 @@ rgb = hsi2rgb(hsi) # rgb: (3, 11, 11)
2626
3. More examples can be found in [test.py](core/tests/test.py)
2727

2828

29-
## GUI
30-
[Online HuggingFace Demo](https://huggingface.co/spaces/songyz2019/hsi2rgb)
31-
29+
## GUI with Docker
30+
<!-- [Online HuggingFace Demo](https://huggingface.co/spaces/songyz2019/hsi2rgb) -->
3231
1. Run the container: `docker run -it -p 7860:7860 songyz2019/hsi2rgb`
3332
2. Open `http://localhost:7860` in your browser
3433
3. Upload your HSI image (`.mat` or `.tif`)
3534
4. Set the wave length range
3635
5. Submit and see the result
3736

37+
## GUI with pip/pipx/uvx
38+
Don't like docker? You can try use the GUI with pip, pipx, or uvx
39+
40+
```bash
41+
# For pip:
42+
pip install hsi2rgb_gui
43+
hsi2rgb_gui
44+
45+
# For uv, run:
46+
uvx hsi2rgb_gui
47+
48+
# For pipx:
49+
pip install hsi2rgb_gui
50+
hsi2rgb_gui
51+
```
52+
53+
3854
# Build
39-
## uv
55+
## Python Package
4056
1. Install [uv](https://docs.astral.sh/uv/)
4157
2. Simply sync dependicies and build
4258
```bash
59+
cd core
4360
uv sync
4461
uv build
4562
```
4663

47-
## Docker
48-
> The docker app is under refactor, please use [this branch](https://github.com/songyz2019/hsi2rgb/tree/f2c76629b49659e7d16ec62958c8a972e97fde3c) to build currently.
49-
1. Build the container: `docker compose build`
50-
2. Run the container: `docker compose up -d`
64+
## Docker GUI
65+
1. Open the `gui` folder: `cd gui`
66+
2. Build the container: `docker compose build`
67+
3. Run the container: `docker compose up -d`
5168

5269
# License
5370
```text

gui/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ WORKDIR /app
77
ADD ./ /app/
88
# Avoid unnecessary uv sync
99
RUN rm -rf /app/src
10-
RUN uv sync --frozen --no-cache
10+
# The --no-cache for uv make huggingface buggy, with errors like permission denied for /uv/.cache
11+
RUN uv sync --frozen
12+
1113

1214
# Use these commands in alphine linux since there's no manylinux musl for scikit-image
1315
# The image size of alphine can be reduced to 650MB without aggressive optimization.
@@ -25,4 +27,4 @@ EXPOSE 7860
2527
ENV GRADIO_SERVER_NAME="0.0.0.0"
2628

2729
# We should make Dockerfile less coupled with the project and focusing on environment setup
28-
CMD ["uv", "run", "start"]
30+
CMD ["uv", "run", "hsi2rgb_gui"]

gui/pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "hsi2rgb-gui"
3-
version = "1.2.0"
3+
version = "1.2.2"
44
description = "Easily convert a hyperspectral image to an RGB image."
55
readme = "README.md"
66
requires-python = ">=3.13"
@@ -15,8 +15,12 @@ dependencies = [
1515
]
1616
license = { file = "LICENSE" }
1717
classifiers = [
18-
"Private :: Do Not Upload",
19-
"Development Status :: 4 - Beta",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
23+
"Programming Language :: Python :: Implementation :: CPython",
2024
]
2125

2226
[build-system]
@@ -32,6 +36,6 @@ dev = [
3236
]
3337

3438
[project.scripts]
35-
start = "hsi2rgb_gui.web:main"
39+
hsi2rgb_gui = "hsi2rgb_gui.web:main"
3640

3741

gui/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)