Skip to content

Deployment experiment for Streamlit, OpenAI Whisper, Google Cloud Run

License

Notifications You must be signed in to change notification settings

willgroves/AudioTranslateDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Audio Translate Demo

· View Live Demo · Report Bug · Request Feature ·

About The Project

  • AudioTranslateDemo is a demo of the OpenAI Whisper transcription and translation model released and discussed in this paper. It is a simple web frontend that allows you to upload an audio file and translate it to text. The text is then translated to another language and spoken back to you.

(back to top)

Motivation

This repository demonstrates deployment of a Streamlit application to the Google Cloud Platform. In particular, it exercises several features:

  • OpenAI Whisper transcription and translation model in a single deep learning model (unlike the traditional two phase system of Automatic Speech Recognition and Translation)
  • Cloud Run for hosting the application in a way that can facilitate scale to zero (no resources are consumed if the service is not being actively used)
  • Streamlit for the web frontend
  • Docker for containerization
  • Google Cloud Build for building the container and deploying to Cloud Run
  • Google Cloud Artifact Registry for storing the container image

Getting Started

To try things out, you can use the live demo at https://audio.nyctaxi.me/. If deploying another instance is the goal, then read on.

Build and Deploy

  1. Build the Docker container locally
bash container_build.sh
  1. Test the container locally
docker run -p 8080:8080 -it us-east1-docker.pkg.dev/gcloudsdk-on-wmm/gdocker/audiotranslatedemo:v20221121a

Then browse to http://localhost:8080/ to see the Streamlit application running locally.

  1. Upload the container to Google Artifact Registry
UPLOAD=1 bash container_build.sh
  1. Determine the DNS names of the frontend server for your deployment

  2. Instantiate and configure the container in Google Cloud Run on the Google Cloud console.

(back to top)

Usage

To interact with the deployed demo system, browse to https://audio.nyctaxi.me/.

(back to top)

Roadmap

  • Make the demo look nicer in streamlit
  • The streamlit audio recorder does not seem to be stable on mobile devices. Investigate alternatives.

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

William Groves - @willgrovesemail

Project Link: https://github.com/willgroves/audiotranslatedemo

(back to top)

References

  • Widget for recording audio in streamlit frontends: here
  • Deploying to Google Cloud Platform App Engine seems well documented: here
  • A tutorial on deploying Streamlit applications to Google Cloud Run can be found here.
  • Another article
  • Name collisions for paths ending in the character z does seem to be a problem for GCP (e.g. /healthz, which is a core component of streamlit): here
  • A great template: Best-README-Template

Appendix

It is also possible to run the whisper model from the command line with examples like below:

whisper src/audio.wav --language zh
whisper src/audio.wav --language zh --task translate

About

Deployment experiment for Streamlit, OpenAI Whisper, Google Cloud Run

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published