Skip to content

Commit

Permalink
Add an integration test for whisper (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Oct 4, 2024
1 parent 92079f7 commit 3e9a730
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ services:
image: ${DOCKER_REPOSITORY_BASE}-imagemagick:${DOCKER_TAG}
tesseract:
image: ${DOCKER_REPOSITORY_BASE}-tesseract:${DOCKER_TAG}
whisper:
image: ${DOCKER_REPOSITORY_BASE}-whisper:${DOCKER_TAG}
test:
image: alpine
command: sleep 300
Expand Down
2 changes: 1 addition & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ docker exec ci-test-1 /test.sh
echo $?

docker compose down 2>&1 > /dev/null
docker compose rm 2>&1 > /dev/null
docker compose rm 2>&1 > /dev/null
9 changes: 9 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SERVICES=(
"imagemagick"
"crayfits"
"ffmpeg"
"whisper"
)
for SERVICE in "${SERVICES[@]}"; do
URL="http://$SERVICE:8080/"
Expand Down Expand Up @@ -58,6 +59,14 @@ for SERVICE in "${SERVICES[@]}"; do
grep "One time I was ridin' along on the mule" ocr.txt || exit 1
echo "PDF OCR as expected"
rm ocr.txt
elif [ "$SERVICE" == "whisper" ]; then
curl -s -o vtt.txt \
--header "Accept: text/plain" \
--header "Apix-Ldp-Resource: https://github.com/ggerganov/whisper.cpp/raw/master/samples/jfk.wav" \
"$URL"
grep "ask not what your country can do for you" vtt.txt || exit 1
echo "VTT as expected"
rm vtt.txt
else
echo "Unknown service"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions examples/whisper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ COPY --from=scyllaridae /app /app
COPY scyllaridae.yml /app
COPY cmd.sh /app

RUN bash ./models/download-ggml-model.sh medium.en

RUN apt-get update && apt-get install -y gosu=1.14-1 --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& groupadd -r nobody \
Expand Down
4 changes: 0 additions & 4 deletions examples/whisper/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

set -eou pipefail

if [ ! -f /app/models/ggml-medium.en.bin ]; then
bash ./models/download-ggml-model.sh medium.en > /dev/null 2>&1
fi

# take stdin and buffer it into a temp file
input_temp=$(mktemp /tmp/whisper-input-XXXXXX)
cat > "$input_temp"
Expand Down

0 comments on commit 3e9a730

Please sign in to comment.