Streamlit Colab

Run Streamlit apps with ngrok tunneling easily from the command line.

Introduction

Streamlit Colab is a command-line tool that allows you to run Streamlit applications with ngrok tunneling. This makes your local Streamlit app accessible via a public URL, which is especially useful for sharing your app with others or for testing purposes.

Installation

To install Streamlit Colab, follow these steps:

pip install streamlit-colab

Usage

Run your Streamlit app with ngrok tunneling using the following command:

stc <app.py> <ngrok_token> [port]

Parameters:

Examples

1. Running with Default Port (8501)

To run your Streamlit app on the default port 8501:

stc /path/to/your/app.py <your_ngrok_token>

2. Running with a Custom Port (e.g., 5005)

To run your Streamlit app on a custom port, such as 5005:

stc /path/to/your/app.py <your_ngrok_token> 5005

3. Using an Environment Variable for ngrok Token

You can set the ngrok token as an environment variable and omit it from the command:

export NGROK_TOKEN=<your_ngrok_token>
stc /path/to/your/app.py

Note: This will default to port 8501.

To override the port:

stc /path/to/your/app.py 5005