diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2ddf570 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index cbefb7e..43a8a0c 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/examples/test.py b/examples/test.py index 1ab8512..58e307b 100644 --- a/examples/test.py +++ b/examples/test.py @@ -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: