Skip to content

Commit

Permalink
add code for model downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
phenylshima committed Nov 23, 2023
1 parent 36a0c7a commit 5ca7103
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ RUN npm ci
COPY ./src/ ./src/
RUN npm run build

FROM node:18 AS model-fetch

WORKDIR /app
RUN wget https://github.com/jpreprocess/jpreprocess/releases/download/v0.6.1/naist-jdic-jpreprocess.tar.gz \
&& tar xzf naist-jdic-jpreprocess.tar.gz \
&& rm naist-jdic-jpreprocess.tar.gz
RUN wget http://downloads.sourceforge.net/open-jtalk/hts_voice_nitech_jp_atr503_m001-1.05.tar.gz \
&& tar xzf hts_voice_nitech_jp_atr503_m001-1.05.tar.gz \
&& mv hts_voice_nitech_jp_atr503_m001-1.05/* ./ \
&& rm hts_voice_nitech_jp_atr503_m001-1.05.tar.gz \
&& rmdir hts_voice_nitech_jp_atr503_m001-1.05

FROM gcr.io/distroless/nodejs18-debian12:nonroot AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY ./package.json ./
COPY --from=builder /app/dist/ ./dist/
COPY --from=deps /app/node_modules/ ./node_modules/
COPY --from=model-fetch /app/ ./model/
CMD ["dist/main.js"]
7 changes: 2 additions & 5 deletions src/synthesis/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Synthesizer } from "./synthesizer";
import WorkerSynthesizer from "./worker-synthesizer";

if (!process.env.DICTIONARY || !process.env.MODEL) {
throw new Error("Dictionary and model must be specified.");
}
export const synthesizer: Synthesizer = new WorkerSynthesizer(
process.env.DICTIONARY,
process.env.MODEL,
process.env.DICTIONARY ?? "/app/model/naist-jdic",
process.env.MODEL ?? "/app/model/nitech_jp_atr503_m001.htsvoice",
);

0 comments on commit 5ca7103

Please sign in to comment.