Giter Site home page Giter Site logo

manhph2211 / ml-deployment Goto Github PK

View Code? Open in Web Editor NEW
21.0 3.0 3.0 36.79 MB

Pushing Text To Speech models into production using torchserve, kubernetes and react web app :smile:

License: MIT License

Python 39.18% Shell 2.55% Dockerfile 2.47% HTML 4.10% CSS 9.55% JavaScript 25.27% TypeScript 16.87%
text-to-speech kubernetes react tts-api voice-synthesis tts-demo torchserve tts-service mlops mlopsvn

ml-deployment's Introduction

Text to speech Service

This repo aims to push a simple TTS model into production using torchserve, kubernetes and react web app. I also add Jenkine file for a simple CI/CD pipeline. I always aim to build clear template for you to even make better product ๐Ÿ˜„ Check out my previous template in which I play with Jax, FastAPI, Streamlit and Docker-Compose if you're interested.

image

Okay, get started with cloning this repo: git clone https://github.com/manhph2211/TTSSVC && cd TTSSVC

Backend

Activate Environment

cd backend
conda create -n tts_app python=3.8
conda activate tts_app

Install Dependencies

pip install torch==2.0.0+cu118 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt

Serve speech synthesis model on TorchServe

  • Generate the model archive for waveglow speech synthesis model:

    bash ./create_mar.sh
    
  • Run torchserve API:

    torchserve --start --model-store model_store --models waveglow_synthesizer.mar --ts-config config.properties
    
  • Check API and see the audio output:

    python client.py
    

Deploy on Kubernetes

If you want to further deploy your app on Kubernetes Clusters, you can first install the Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters.

Next, adjust the config files (kubeconfig.yaml, deployment.yaml, service.yaml) to yours

Then you need to build and push your image into dockerhub:

docker login
docker build -t app . 
docker tag app user/app 
docker push user/app
export KUBECONFIG=kubeconfig.yaml 
kubectl apply -f deployment.yaml 
kubectl apply -f service.yaml 

MiddleWare

For this service, you need to install mongoDB and create your mongoDB Atlas account, adjust file middleware/src/database/index.js with your mongoDB atlas username and password.

This uses expressjs to create TTS API gateway, authen API for login and for TTS audio dashboard API that connected the database. Simply run:

cd middleware
npm i  && npm start

More at MiddleWare

Frontend

I used React for developing my TTS demo curently supporting login, dashboard, tts ... ๐Ÿ˜ƒ This is how the app looks like:

image Anyway, run this for the app:

cd frontend
npm i  && npm start

ml-deployment's People

Contributors

manhph2211 avatar sonhm3029 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.