Browse Source

update build commands

subDesTagesMitExtraKaese 1 month ago
parent
commit
135d6b2c49
2 changed files with 11 additions and 11 deletions
  1. 10 10
      Dockerfile
  2. 1 1
      speech_recognition.py

+ 10 - 10
Dockerfile

@@ -1,14 +1,14 @@
 # build image
-FROM debian:bullseye-slim AS builder
-WORKDIR /build/
-RUN apt-get update && apt-get install --no-install-recommends -y \
-    make gcc g++ wget \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
+FROM ubuntu:22.04 AS builder
+WORKDIR /app/
+
+RUN apt-get update && \
+  apt-get install -y build-essential wget cmake git \
+  && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
 
 # Install Whisper.cpp
-ADD whisper.cpp/ /build/
-RUN make
+ADD whisper.cpp/ /app/
+RUN cmake -B build && cmake --build build --config Release
 
 # main image
 FROM python:3.12-slim-bullseye
@@ -18,7 +18,7 @@ WORKDIR /app/
 RUN apt-get update && apt-get install -y \
     ffmpeg libolm-dev gcc make wget\
  && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
+ && rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
 
 ADD requirements.txt .
 
@@ -26,7 +26,7 @@ RUN pip install -r requirements.txt && \
   apt-get remove -y gcc make && \
   apt-get autoremove -y
 
-COPY --from=builder /build/main /app/
+COPY --from=builder /app/build/bin/whisper-cli /app/
 
 VOLUME /data/
 

+ 1 - 1
speech_recognition.py

@@ -88,7 +88,7 @@ class ASR():
     convert_audio(audio, filename)
     async with self.lock:
       proc = await asyncio.create_subprocess_exec(
-          "./main",
+          "./whisper-cli",
           "-m", f"{self.model_path}/ggml-{self.model}.bin",
           "-l", self.language,
           "-f", filename,