From 6f90149d41ccd561d28e40023eeab6e20832c4bb Mon Sep 17 00:00:00 2001 From: HeNine <> Date: Sun, 7 Nov 2021 09:59:04 +0100 Subject: [PATCH] Database reference fix and model fetching --- buscribe/Dockerfile | 10 +++------- buscribe/buscribe/buscribe.py | 2 +- fetch_models.sh | 11 +++++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) create mode 100644 fetch_models.sh diff --git a/buscribe/Dockerfile b/buscribe/Dockerfile index 20e63ee..a6ed372 100644 --- a/buscribe/Dockerfile +++ b/buscribe/Dockerfile @@ -8,12 +8,8 @@ RUN pip install /tmp/common && rm -r /tmp/common COPY buscribe /tmp/buscribe RUN pip install /tmp/buscribe && rm -r /tmp/buscribe && \ - mkdir /usr/share/buscribe && cd /usr/share/buscribe && \ - curl -LO http://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip && \ - unzip vosk-model-en-us-0.22.zip && rm vosk-model-en-us-0.22.zip && \ - curl -LO http://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip && \ - unzip vosk-model-small-en-us-0.15.zip && rm vosk-model-small-en-us-0.15.zip && \ - curl -LO https://alphacephei.com/vosk/models/vosk-model-spk-0.4.zip && \ - unzip vosk-model-spk-0.4.zip && rm vosk-model-spk-0.4.zip + mkdir /usr/share/buscribe && cd /usr/share/buscribe + +COPY models/extracted /usr/share/buscribe ENTRYPOINT ["python3", "-m", "buscribe", "--base-dir", "/mnt"] diff --git a/buscribe/buscribe/buscribe.py b/buscribe/buscribe/buscribe.py index 32adf02..7ece7c8 100644 --- a/buscribe/buscribe/buscribe.py +++ b/buscribe/buscribe/buscribe.py @@ -65,7 +65,7 @@ def transcribe_segments(segments: list, sample_rate: int, recognizer: BuscribeRe def write_line(line_json: dict, line_start_time: datetime, line_end_time: datetime, db_cursor): """Commits line to the database""" db_cursor.execute( - "INSERT INTO buscribe.public.buscribe_transcriptions(" + "INSERT INTO buscribe_transcriptions(" "start_time, " "end_time, " "transcription_line, " diff --git a/fetch_models.sh b/fetch_models.sh new file mode 100644 index 0000000..c913d39 --- /dev/null +++ b/fetch_models.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mkdir models && cd models || exit +curl -LO http://alphacephei.com/vosk/models/vosk-model-en-us-0.22.zip +curl -LO http://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip +curl -LO https://alphacephei.com/vosk/models/vosk-model-spk-0.4.zip + +mkdir extracted +unzip vosk-model-en-us-0.22.zip -d extracted +unzip vosk-model-small-en-us-0.15.zip -d extracted +unzip vosk-model-spk-0.4.zip -d extracted