Skip to content

Commit

Permalink
Add Dockerfile example
Browse files Browse the repository at this point in the history
  • Loading branch information
trungkienbkhn committed May 10, 2024
1 parent 2f6913e commit a6ce85a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM nvidia/cuda:12.0.0-runtime-ubuntu20.04

WORKDIR /root
RUN apt-get update -y && apt-get install -y python3 python3-pip libcudnn8 libcudnn8-dev
COPY infer.py jfk.flac ./
RUN pip3 install faster-whisper

ENTRYPOINT ["python3", "infer.py"]
7 changes: 7 additions & 0 deletions docker/infer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from faster_whisper import WhisperModel

jfk_path = "jfk.flac"
model = WhisperModel("tiny", device="cuda")
segments, info = model.transcribe(jfk_path, word_timestamps=True)
for segment in segments:
print("[%.2fs -> %.2fs] %s" % (segment.start, segment.end, segment.text))
Binary file added docker/jfk.flac
Binary file not shown.

0 comments on commit a6ce85a

Please sign in to comment.