Skip to content

Commit

Permalink
Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
prouast committed Nov 12, 2024
1 parent 7171142 commit b9f4e96
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.9-slim
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install -y \
build-essential \
git \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY . /app
RUN pip install --upgrade pip setuptools wheel
RUN pip install .
RUN pip install matplotlib pandas
ENTRYPOINT ["python", "examples/test.py"]
CMD ["--api_key", "", "--vitals_path", "examples/sample_vitals_1.csv", "--video_path", "examples/sample_video_1.mp4", "--method", "VITALLENS", "--input_str", "True"]
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,45 @@ vl = VitalLens(method=Method.POS)
result = vl(my_video_arr, fps=my_video_fps)
```

### Example: Run example script with Docker

If you encounter issues installing `vitallens-python` dependencies directly, you can use our Docker image, which contains all necessary tools and libraries.
This docker image is set up to execute the example Python script in `examples/test.py` for you.
Please note that the example script plots won't work when running them through Docker.

#### Prerequisites

- [Docker](https://docs.docker.com/engine/install/) installed on your system.

#### Usage

1. Build the Docker image

```
docker build -t vitallens .
```

2. Run the Docker container

To run the example script on the sample video:

```
docker run vitallens \
--api_key "your_api_key_here" \
--vitals_path "examples/sample_vitals_2.csv" \
--video_path "examples/sample_video_2.mp4" \
--method "VITALLENS"
```

You can also run it on your own video:

```
docker run vitallens \
--api_key "your_api_key_here" \
--video_path "path/to/your/video.mp4" \
--method "VITALLENS"
```

## Linting and tests

Before running tests, please make sure that you have an environment variable `VITALLENS_DEV_API_KEY` set to a valid API Key.
Expand Down
2 changes: 2 additions & 0 deletions examples/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def run(args=None):
stop = timeit.default_timer()
time_ms = (stop-start)*1000
print("Inference time: {:.2f} ms".format(time_ms))
# Print the results
print(result)
# Plot the results
vital_signs = result[0]['vital_signs']
if "respiratory_waveform" in vital_signs:
Expand Down

0 comments on commit b9f4e96

Please sign in to comment.