Skip to content

Commit 32121db

Browse files
committed
Update python_websocket_server example to Coqui STT 1.1.0
1 parent 00df423 commit 32121db

File tree

17 files changed

+53
-53
lines changed

17 files changed

+53
-53
lines changed

python_websocket_server/Dockerfile

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
FROM tensorflow/tensorflow:1.15.2-py3
22

3-
ARG DEEPSPEECH_CONTAINER_DIR=/opt/deepspeech
4-
ARG DEEPSPEECH_VERSION=0.8.2
3+
ARG STT_CONTAINER_DIR=/opt/stt
4+
ARG STT_MODEL_ID=english/coqui/v1.0.0-huge-vocab
55

66
# Install OS dependencies
77
RUN apt-get update && \
88
apt-get install --no-install-recommends -y wget ffmpeg && \
99
apt-get clean
1010

1111
# Create app directory
12-
RUN mkdir -p ${DEEPSPEECH_CONTAINER_DIR}
12+
RUN mkdir -p ${STT_CONTAINER_DIR}
1313

1414
# Get pre-trained model
15-
RUN wget -q "https://github.com/mozilla/DeepSpeech/releases/download/v${DEEPSPEECH_VERSION}/deepspeech-${DEEPSPEECH_VERSION}-models.pbmm" \
16-
-O ${DEEPSPEECH_CONTAINER_DIR}/model.pbmm
17-
RUN wget -q "https://github.com/mozilla/DeepSpeech/releases/download/v${DEEPSPEECH_VERSION}/deepspeech-${DEEPSPEECH_VERSION}-models.scorer" \
18-
-O ${DEEPSPEECH_CONTAINER_DIR}/scorer.scorer
15+
RUN wget -q "https://github.com/coqui-ai/STT-models/releases/download/v${STT_MODEL_ID}/model.tflite" \
16+
-O ${STT_CONTAINER_DIR}/model.tflite
17+
RUN wget -q "https://github.com/coqui-ai/STT-models/releases/download/v${STT_MODEL_ID}/huge-vocabulary.scorer" \
18+
-O ${STT_CONTAINER_DIR}/scorer.scorer
1919

2020
# Install Python dependencies
2121
RUN pip3 install --upgrade pip
@@ -24,9 +24,9 @@ COPY requirements.txt /tmp
2424
RUN pip3 install -r /tmp/requirements.txt
2525

2626
# Copy code and configs
27-
COPY deepspeech_server ${DEEPSPEECH_CONTAINER_DIR}/deepspeech_server
28-
COPY application.conf ${DEEPSPEECH_CONTAINER_DIR}
27+
COPY stt_server ${STT_CONTAINER_DIR}/stt_server
28+
COPY application.conf ${STT_CONTAINER_DIR}
2929

30-
WORKDIR ${DEEPSPEECH_CONTAINER_DIR}
30+
WORKDIR ${STT_CONTAINER_DIR}
3131

32-
ENTRYPOINT python -m deepspeech_server.app
32+
ENTRYPOINT python -m stt_server.app

python_websocket_server/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Python websocket-based server
22

33
This directory contains a simple service that receives audio data from clients, and serves the results
4-
of DeepSpeech inference over a websocket. The server code in this project is a modified version of
4+
of STT inference over a websocket. The server code in this project is a modified version of
55
[this GitHub project](https://github.com/zelo/deepspeech-rest-api).
66

77
Because STT transcriptions can typically be considered "long running tasks", using websockets for client-server
@@ -22,7 +22,7 @@ Server configuration is specified in the [`application.conf`](application.conf)
2222
Make sure your model and scorer files are present in the same directory as the `application.conf` file. Then execute:
2323

2424
```
25-
python -m deepspeech_server.app
25+
python -m stt_server.app
2626
```
2727

2828
### Sending requests to server
@@ -65,7 +65,7 @@ Example output:
6565
### Kubernetes
6666

6767
The [helm](helm) directory contains an example Helm deployment, that configures an Nginx ingress to expose the
68-
DeepSpeech service. The websocket timeout on the ingress is set to 1 hour.
68+
STT service. The websocket timeout on the ingress is set to 1 hour.
6969

7070
## Contributing
7171

python_websocket_server/application.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
deepspeech {
1+
stt {
22
model = "model.tflite"
33
scorer = "scorer.scorer"
44
}

python_websocket_server/helm/deepspeech-server/Chart.yaml renamed to python_websocket_server/helm/stt_server/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
2-
name: deepspeech-server
3-
description: A server for DeepSpeech
2+
name: stt-server
3+
description: A server for Coqui STT
44

55
# A chart can be either an 'application' or a 'library' chart.
66
#

python_websocket_server/helm/deepspeech-server/overrides/values.dev.yaml renamed to python_websocket_server/helm/stt_server/overrides/values.dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default values for deepspeech-server.
1+
# Default values for stt-server.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

@@ -41,7 +41,7 @@ ingress:
4141
nginx.ingress.kubernetes.io/proxy-body-size: 20m
4242
hosts:
4343
- host: "<host>"
44-
paths: ["/deepspeech-server"]
44+
paths: ["/stt-server"]
4545
tls:
4646
- secretName: "<secret_name>"
4747
hosts:

python_websocket_server/helm/deepspeech-server/overrides/values.prod.yaml renamed to python_websocket_server/helm/stt_server/overrides/values.prod.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Default values for deepspeech-server.
1+
# Default values for stt-server.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

@@ -41,7 +41,7 @@ ingress:
4141
nginx.ingress.kubernetes.io/proxy-body-size: 20m
4242
hosts:
4343
- host: "<host>"
44-
paths: ["/deepspeech-server"]
44+
paths: ["/stt-server"]
4545
tls:
4646
- secretName: "<secret_name>"
4747
hosts:

python_websocket_server/helm/deepspeech-server/templates/_helpers.tpl renamed to python_websocket_server/helm/stt_server/templates/_helpers.tpl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "deepspeech-server.name" -}}
4+
{{- define "stt-server.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

@@ -10,7 +10,7 @@ Create a default fully qualified app name.
1010
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1111
If release name contains chart name it will be used as a full name.
1212
*/}}
13-
{{- define "deepspeech-server.fullname" -}}
13+
{{- define "stt-server.fullname" -}}
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
2626
{{/*
2727
Create chart name and version as used by the chart label.
2828
*/}}
29-
{{- define "deepspeech-server.chart" -}}
29+
{{- define "stt-server.chart" -}}
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

3333
{{/*
3434
Common labels
3535
*/}}
36-
{{- define "deepspeech-server.labels" -}}
37-
helm.sh/chart: {{ include "deepspeech-server.chart" . }}
38-
{{ include "deepspeech-server.selectorLabels" . }}
36+
{{- define "stt-server.labels" -}}
37+
helm.sh/chart: {{ include "stt-server.chart" . }}
38+
{{ include "stt-server.selectorLabels" . }}
3939
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
4040
app.kubernetes.io/managed-by: {{ .Release.Service }}
4141
date: "{{ now | unixEpoch }}"
@@ -44,17 +44,17 @@ date: "{{ now | unixEpoch }}"
4444
{{/*
4545
Selector labels
4646
*/}}
47-
{{- define "deepspeech-server.selectorLabels" -}}
48-
app.kubernetes.io/name: {{ include "deepspeech-server.name" . }}
47+
{{- define "stt-server.selectorLabels" -}}
48+
app.kubernetes.io/name: {{ include "stt-server.name" . }}
4949
app.kubernetes.io/instance: {{ .Release.Name }}
5050
{{- end }}
5151

5252
{{/*
5353
Create the name of the service account to use
5454
*/}}
55-
{{- define "deepspeech-server.serviceAccountName" -}}
55+
{{- define "stt-server.serviceAccountName" -}}
5656
{{- if .Values.serviceAccount.create }}
57-
{{- default (include "deepspeech-server.fullname" .) .Values.serviceAccount.name }}
57+
{{- default (include "stt-server.fullname" .) .Values.serviceAccount.name }}
5858
{{- else }}
5959
{{- default "default" .Values.serviceAccount.name }}
6060
{{- end }}

python_websocket_server/helm/deepspeech-server/templates/deployment.yaml renamed to python_websocket_server/helm/stt_server/templates/deployment.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "deepspeech-server.fullname" . }}
4+
name: {{ include "stt-server.fullname" . }}
55
labels:
6-
{{- include "deepspeech-server.labels" . | nindent 4 }}
6+
{{- include "stt-server.labels" . | nindent 4 }}
77
spec:
88
{{- if not .Values.autoscaling.enabled }}
99
replicas: {{ .Values.replicaCount }}
1010
{{- end }}
1111
selector:
1212
matchLabels:
13-
{{- include "deepspeech-server.selectorLabels" . | nindent 6 }}
13+
{{- include "stt-server.selectorLabels" . | nindent 6 }}
1414
template:
1515
metadata:
1616
{{- with .Values.podAnnotations }}
1717
annotations:
1818
{{- toYaml . | nindent 8 }}
1919
{{- end }}
2020
labels:
21-
{{- include "deepspeech-server.selectorLabels" . | nindent 8 }}
21+
{{- include "stt-server.selectorLabels" . | nindent 8 }}
2222
spec:
2323
{{- with .Values.imagePullSecrets }}
2424
imagePullSecrets:

python_websocket_server/helm/deepspeech-server/templates/ingress.yaml renamed to python_websocket_server/helm/stt_server/templates/ingress.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{{- if .Values.ingress.enabled -}}
2-
{{- $fullName := include "deepspeech-server.fullname" . -}}
2+
{{- $fullName := include "stt-server.fullname" . -}}
33
{{- $svcPort := .Values.service.port -}}
44
apiVersion: extensions/v1beta1
55
kind: Ingress
66
metadata:
77
name: {{ $fullName }}
88
labels:
9-
{{- include "deepspeech-server.labels" . | nindent 4 }}
9+
{{- include "stt-server.labels" . | nindent 4 }}
1010
{{- with .Values.ingress.annotations }}
1111
annotations:
1212
{{- toYaml . | nindent 4 }}

0 commit comments

Comments
 (0)