Skip to content

Media streaming to Google Colab instance via WebRTC.

Notifications You must be signed in to change notification settings

thefonseca/colabrtc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColabRTC

ColabRTC contains early experiments to stream media from your machine to a Google Colab instance using Web Real-Time Communication (WebRTC). It is built on top of aiortc.

The motivation behind this project was to learn about WebRTC and because an efficient implementation of this kind of communication could be useful to prototype Deep Learning models without a local GPU.

How to use ColabRTC?

The API allows one to create a ColabCall, which consists of a Python peer (running on Colab) and a Javascript peer (started in a Colab cell HTML context, which runs on the local machine). The signaling medium is the Colab filesystem (and Google Drive, optionally).

An example:

Open In Colab

from call import ColabCall
import cv2

# Define a frame processing routine
def process_frame(frame, frame_idx):
  # To speed up, apply processing every two frames
  if frame_idx % 2 == 1:
    edges = cv2.Canny(frame, 100, 200)
    return cv2.cvtColor(edges, cv2.COLOR_GRAY2BGR)
  
call = ColabCall()
# Create the Python peer
call.create(frame_transformer=process_frame)
# Create the Javascript peer and display the UI
call.join()

About

Media streaming to Google Colab instance via WebRTC.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published