Deploy web application(streamlit) using google colab and ngrok

Deploy Web app in ngrok

Prerequisite:

Packages:

  • streamlit – pip install streamlit
  • pyngrok – pip install pyngrok

Notes

  • use %%writefile filename to write data in to the cell.
  • !ngrok in the cell – displays the options available in ngrok
  • !ngrok authtoken yourtoken from the section 2.Connect your account @https://dashboard.ngrok.com/get-started/setup – Setup & Installation.
  • https://dashboard.ngrok.com/auth/your-authtoken – Displays the token value.

Trouble shoot

  • Issue1: PyngrokNgrokHTTPError: ngrok client exception, API returned 502: {"error_code":103,"status_code":502,"msg":"failed to start tunnel","details":{"err":"Your account may not run more than 4 tunnels over a single ngrok client session –Solution: !kill processid of the app. Eg:- !kill 1234
  • Tip: To check the tunnels running for your account in ngrok –Solution: https://dashboard.ngrok.com/status/tunnels

Notes

  • If you would like to modify the content of the script then modify the script and re-run the cell so that latest contents will be available and go to the url and check that.

Alternatives for deploying the streamlit App

  • Heroku
  • AWS
  • GCP

Alternatives to Streamlit Package

  • Jupyter-dash
  • bokeh
  • plotify

Notebook

Final Output – Web Application Running in ngrok

Leave a comment

Design a site like this with WordPress.com
Get started