Getting Started

Every notebook server has their own port forwarding URL that you can find by running echo $PORT_FORWARD_URL in your terminal. You can use this to immediately deploy and run apps directly in your notebook and securely share them on a public URL. Here’s an example you can run in a notebook that launches a gradio server on localhost:5000 in your notebook server.

python
import gradio as gr

def greet(name, intensity):
    return "Hello, " + name + "!" * int(intensity)

demo = gr.Interface(
    fn=greet,
    inputs=["text", "slider"],
    outputs=["text"],
)

demo.launch(server_port=5000)

!echo $PORT_FORWARD_URL

How It Works

  1. Run Your Application: Launch your web application (like a Flask app, Streamlit dashboard, or React development server) on your server.
  2. Secure Access: Access your application through a secure, public URL generated specifically for your session.

Using Port Forwarding

The port forwarding interface is located in the bottom panel alongside the terminal:

  1. View Running Applications: See all applications running on open ports.
  2. Access URL: Each forwarded port gets a unique URL that remains active as long as your application is running.
  3. Copy URL: Easily copy the public URL to share with others or use in other applications.

Configuring Ports

To change the default port configurations:

  1. Stop your server from the “Manage Servers” page.
  2. Click the “Edit” button for your server.
  3. Modify the port settings in the configuration panel.
  4. Restart your server with the new configuration.

Make sure your application is set to listen on 0.0.0.0 rather than just localhost to ensure it’s accessible through port forwarding.