Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trisgelar/86968b75a3ff84f1425c1ccee6ad0415 to your computer and use it in GitHub Desktop.
Save trisgelar/86968b75a3ff84f1425c1ccee6ad0415 to your computer and use it in GitHub Desktop.
Streamlit WebRTC Component_on_Colab.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Streamlit WebRTC Component_on_Colab.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyN7P2N64DuLcrU4h1/LiwsB",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/trisgelar/86968b75a3ff84f1425c1ccee6ad0415/streamlit-webrtc-component_on_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "q1qbeu7L34hD"
},
"source": [
"## Instalasi Library streamlit-Webrtc"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IljgE6IeODmT",
"outputId": "756d67ee-33d4-4b2e-892a-1ccc901dd4fd"
},
"source": [
"%%shell\n",
"pip install streamlit-webrtc opencv-python"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting streamlit-webrtc\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/57/04/95c2b6420724f11d90976c75be1bb1956345afd3a6fbe1c5432a3a2b40f2/streamlit_webrtc-0.24.0-py3-none-any.whl (877kB)\n",
"\r\u001b[K |▍ | 10kB 25.5MB/s eta 0:00:01\r\u001b[K |▊ | 20kB 31.7MB/s eta 0:00:01\r\u001b[K |█▏ | 30kB 33.3MB/s eta 0:00:01\r\u001b[K |█▌ | 40kB 33.2MB/s eta 0:00:01\r\u001b[K |█▉ | 51kB 35.6MB/s eta 0:00:01\r\u001b[K |██▎ | 61kB 38.3MB/s eta 0:00:01\r\u001b[K |██▋ | 71kB 34.3MB/s eta 0:00:01\r\u001b[K |███ | 81kB 34.8MB/s eta 0:00:01\r\u001b[K |███▍ | 92kB 31.6MB/s eta 0:00:01\r\u001b[K |███▊ | 102kB 33.0MB/s eta 0:00:01\r\u001b[K |████ | 112kB 33.0MB/s eta 0:00:01\r\u001b[K |████▌ | 122kB 33.0MB/s eta 0:00:01\r\u001b[K |████▉ | 133kB 33.0MB/s eta 0:00:01\r\u001b[K |█████▎ | 143kB 33.0MB/s eta 0:00:01\r\u001b[K |█████▋ | 153kB 33.0MB/s eta 0:00:01\r\u001b[K |██████ | 163kB 33.0MB/s eta 0:00:01\r\u001b[K |██████▍ | 174kB 33.0MB/s eta 0:00:01\r\u001b[K |██████▊ | 184kB 33.0MB/s eta 0:00:01\r\u001b[K |███████ | 194kB 33.0MB/s eta 0:00:01\r\u001b[K |███████▌ | 204kB 33.0MB/s eta 0:00:01\r\u001b[K |███████▉ | 215kB 33.0MB/s eta 0:00:01\r\u001b[K |████████▏ | 225kB 33.0MB/s eta 0:00:01\r\u001b[K |████████▋ | 235kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████ | 245kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████▎ | 256kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████▊ | 266kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████ | 276kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████▌ | 286kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████▉ | 296kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████▏ | 307kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████▋ | 317kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████ | 327kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████▎ | 337kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████▊ | 348kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████ | 358kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████▍ | 368kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████▉ | 378kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████▏ | 389kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████▋ | 399kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████ | 409kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████▎ | 419kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████▊ | 430kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████ | 440kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████▍ | 450kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████▉ | 460kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████▏ | 471kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████▌ | 481kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████ | 491kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████▎ | 501kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████▋ | 512kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████ | 522kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████▍ | 532kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████▉ | 542kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████▏ | 552kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████▌ | 563kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████ | 573kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████▎ | 583kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████▋ | 593kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████ | 604kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████▍ | 614kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████▊ | 624kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████▏ | 634kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████▌ | 645kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████ | 655kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████▎ | 665kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████▋ | 675kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████ | 686kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████▍ | 696kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████▊ | 706kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████████▏ | 716kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████████▌ | 727kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████████▉ | 737kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████████▎ | 747kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████████▋ | 757kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████████ | 768kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████████▍ | 778kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████████▊ | 788kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████████▏ | 798kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████████▌ | 808kB 33.0MB/s eta 0:00:01\r\u001b[K |█████████████████████████████▉ | 819kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████████████▎ | 829kB 33.0MB/s eta 0:00:01\r\u001b[K |██████████████████████████████▋ | 839kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████████████ | 849kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████████████▍| 860kB 33.0MB/s eta 0:00:01\r\u001b[K |███████████████████████████████▊| 870kB 33.0MB/s eta 0:00:01\r\u001b[K |████████████████████████████████| 880kB 33.0MB/s \n",
"\u001b[?25hRequirement already satisfied: opencv-python in /usr/local/lib/python3.7/dist-packages (4.1.2.30)\n",
"Requirement already satisfied: typing_extensions<4.0.0,>=3.7.4; python_version < \"3.8\" in /usr/local/lib/python3.7/dist-packages (from streamlit-webrtc) (3.7.4.3)\n",
"Collecting aiortc<2.0.0,>=1.1.2\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e7/1d/53e22e95f592dd2a5c0890b746b44c77abf338fe51cea5674cbce9be48a6/aiortc-1.2.1-cp37-cp37m-manylinux2010_x86_64.whl (2.0MB)\n",
"\u001b[K |████████████████████████████████| 2.0MB 46.6MB/s \n",
"\u001b[?25hCollecting streamlit!=0.84.0,>=0.73.0\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/38/1e/4d594c5374ecf42595612d561ef75d89b34f4ebea3d0e45ec1e024e15265/streamlit-0.84.1-py2.py3-none-any.whl (7.8MB)\n",
"\u001b[K |████████████████████████████████| 7.8MB 49.6MB/s \n",
"\u001b[?25hRequirement already satisfied: numpy>=1.14.5 in /usr/local/lib/python3.7/dist-packages (from opencv-python) (1.19.5)\n",
"Collecting google-crc32c>=1.1\n",
" Downloading https://files.pythonhosted.org/packages/fc/ae/b6efa1019e18c6c791f0f5cd93b2ff40f8f06696dbf04db39ec0f5591b1e/google_crc32c-1.1.2-cp37-cp37m-manylinux2014_x86_64.whl\n",
"Collecting aioice<0.8.0,>=0.7.5\n",
" Downloading https://files.pythonhosted.org/packages/5a/32/31ec785c02ac848aa4a8503b86afe63e94c6bffd0d53a758a11f1e58224b/aioice-0.7.5-py3-none-any.whl\n",
"Collecting cryptography>=2.2\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/b2/26/7af637e6a7e87258b963f1731c5982fb31cd507f0d90d91836e446955d02/cryptography-3.4.7-cp36-abi3-manylinux2014_x86_64.whl (3.2MB)\n",
"\u001b[K |████████████████████████████████| 3.2MB 45.4MB/s \n",
"\u001b[?25hCollecting pylibsrtp>=0.5.6\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/a2/24/9c2060d5f2d831091c7bb41428d17fd20e839959f1e78e6930329b21c0a7/pylibsrtp-0.6.8-cp37-cp37m-manylinux2010_x86_64.whl (75kB)\n",
"\u001b[K |████████████████████████████████| 81kB 11.7MB/s \n",
"\u001b[?25hRequirement already satisfied: cffi>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from aiortc<2.0.0,>=1.1.2->streamlit-webrtc) (1.14.6)\n",
"Collecting pyee>=6.0.0\n",
" Downloading https://files.pythonhosted.org/packages/0d/0a/933b3931107e1da186963fd9bb9bceb9a613cff034cb0fb3b0c61003f357/pyee-8.1.0-py2.py3-none-any.whl\n",
"Collecting av<9.0.0,>=8.0.0\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/66/ff/bacde7314c646a2bd2f240034809a10cc3f8b096751284d0828640fff3dd/av-8.0.3-cp37-cp37m-manylinux2010_x86_64.whl (37.2MB)\n",
"\u001b[K |████████████████████████████████| 37.2MB 65kB/s \n",
"\u001b[?25hRequirement already satisfied: pillow>=6.2.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (7.1.2)\n",
"Collecting watchdog; platform_system != \"Darwin\"\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/6b/d1/b0a1e69af06d2f6f47a11238ca115667d858cbb30baf6b6df03f1b874163/watchdog-2.1.3-py3-none-manylinux2014_x86_64.whl (75kB)\n",
"\u001b[K |████████████████████████████████| 81kB 12.2MB/s \n",
"\u001b[?25hRequirement already satisfied: protobuf!=3.11,>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.17.3)\n",
"Collecting gitpython\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/bc/91/b38c4fabb6e5092ab23492ded4f318ab7299b19263272b703478038c0fbc/GitPython-3.1.18-py3-none-any.whl (170kB)\n",
"\u001b[K |████████████████████████████████| 174kB 58.2MB/s \n",
"\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (21.0)\n",
"Collecting base58\n",
" Downloading https://files.pythonhosted.org/packages/b8/a1/d9f565e9910c09fd325dc638765e8843a19fa696275c16cc08cf3b0a3c25/base58-2.1.0-py3-none-any.whl\n",
"Requirement already satisfied: tornado>=5.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.1.1)\n",
"Requirement already satisfied: astor in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.8.1)\n",
"Requirement already satisfied: cachetools>=4.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (4.2.2)\n",
"Requirement already satisfied: pyarrow; python_version < \"3.9\" in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.0.0)\n",
"Requirement already satisfied: toml in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.10.2)\n",
"Requirement already satisfied: altair>=3.2.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (4.1.0)\n",
"Collecting validators\n",
" Downloading https://files.pythonhosted.org/packages/db/2f/7fed3ee94ad665ad2c1de87f858f10a7785251ff75b4fd47987888d07ef1/validators-0.18.2-py3-none-any.whl\n",
"Requirement already satisfied: click<8.0,>=7.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (7.1.2)\n",
"Requirement already satisfied: tzlocal in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.5.1)\n",
"Requirement already satisfied: pandas>=0.21.0 in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.1.5)\n",
"Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.23.0)\n",
"Collecting pydeck>=0.1.dev5\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/d6/bc/f0e44828e4290367c869591d50d3671a4d0ee94926da6cb734b7b200308c/pydeck-0.6.2-py2.py3-none-any.whl (4.2MB)\n",
"\u001b[K |████████████████████████████████| 4.2MB 43.5MB/s \n",
"\u001b[?25hCollecting blinker\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/1b/51/e2a9f3b757eb802f61dc1f2b09c8c99f6eb01cf06416c0671253536517b6/blinker-1.4.tar.gz (111kB)\n",
"\u001b[K |████████████████████████████████| 112kB 52.6MB/s \n",
"\u001b[?25hRequirement already satisfied: python-dateutil in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.8.1)\n",
"Requirement already satisfied: attrs in /usr/local/lib/python3.7/dist-packages (from streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (21.2.0)\n",
"Collecting netifaces\n",
" Downloading https://files.pythonhosted.org/packages/c8/05/b41bbe076da2316f4521decf22346b1f20cb81484dc49424a9e58e6f50ae/netifaces-0.11.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl\n",
"Collecting dnspython\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/f5/2d/ae9e172b4e5e72fa4b3cfc2517f38b602cc9ba31355f9669c502b4e9c458/dnspython-2.1.0-py3-none-any.whl (241kB)\n",
"\u001b[K |████████████████████████████████| 245kB 49.2MB/s \n",
"\u001b[?25hRequirement already satisfied: pycparser in /usr/local/lib/python3.7/dist-packages (from cffi>=1.0.0->aiortc<2.0.0,>=1.1.2->streamlit-webrtc) (2.20)\n",
"Requirement already satisfied: six>=1.9 in /usr/local/lib/python3.7/dist-packages (from protobuf!=3.11,>=3.6.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.15.0)\n",
"Collecting gitdb<5,>=4.0.1\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/ea/e8/f414d1a4f0bbc668ed441f74f44c116d9816833a48bf81d22b697090dba8/gitdb-4.0.7-py3-none-any.whl (63kB)\n",
"\u001b[K |████████████████████████████████| 71kB 10.9MB/s \n",
"\u001b[?25hRequirement already satisfied: pyparsing>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.4.7)\n",
"Requirement already satisfied: entrypoints in /usr/local/lib/python3.7/dist-packages (from altair>=3.2.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.3)\n",
"Requirement already satisfied: jsonschema in /usr/local/lib/python3.7/dist-packages (from altair>=3.2.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.6.0)\n",
"Requirement already satisfied: toolz in /usr/local/lib/python3.7/dist-packages (from altair>=3.2.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.11.1)\n",
"Requirement already satisfied: jinja2 in /usr/local/lib/python3.7/dist-packages (from altair>=3.2.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.11.3)\n",
"Requirement already satisfied: decorator>=3.4.0 in /usr/local/lib/python3.7/dist-packages (from validators->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (4.4.2)\n",
"Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from tzlocal->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2018.9)\n",
"Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.0.4)\n",
"Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.24.3)\n",
"Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.10)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2021.5.30)\n",
"Requirement already satisfied: ipywidgets>=7.0.0 in /usr/local/lib/python3.7/dist-packages (from pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (7.6.3)\n",
"Collecting ipykernel>=5.1.2; python_version >= \"3.4\"\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/13/8e/1d868a67488f99692c2604907cdb87ab7da586fa114d5f0f177c83f1aee1/ipykernel-6.0.2-py3-none-any.whl (122kB)\n",
"\u001b[K |████████████████████████████████| 122kB 58.9MB/s \n",
"\u001b[?25hRequirement already satisfied: traitlets>=4.3.2 in /usr/local/lib/python3.7/dist-packages (from pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.0.5)\n",
"Collecting smmap<5,>=3.0.1\n",
" Downloading https://files.pythonhosted.org/packages/68/ee/d540eb5e5996eb81c26ceffac6ee49041d473bc5125f2aa995cf51ec1cf1/smmap-4.0.0-py2.py3-none-any.whl\n",
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.7/dist-packages (from jinja2->altair>=3.2.0->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.0.1)\n",
"Requirement already satisfied: widgetsnbextension~=3.5.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.5.1)\n",
"Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.1.3)\n",
"Requirement already satisfied: ipython>=4.0.0; python_version >= \"3.3\" in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.5.0)\n",
"Requirement already satisfied: jupyterlab-widgets>=1.0.0; python_version >= \"3.6\" in /usr/local/lib/python3.7/dist-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.0.0)\n",
"Requirement already satisfied: jupyter-client<7.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.3.5)\n",
"Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.1.2)\n",
"Collecting importlib-metadata<4; python_version < \"3.8.0\"\n",
" Downloading https://files.pythonhosted.org/packages/52/d0/bdb31463f2d9ca111e39b268518e9baa3542ef73ca449b711a7b4da69764/importlib_metadata-3.10.1-py3-none-any.whl\n",
"Requirement already satisfied: debugpy<2.0,>=1.0.0 in /usr/local/lib/python3.7/dist-packages (from ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.0.0)\n",
"Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.7/dist-packages (from traitlets>=4.3.2->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.2.0)\n",
"Requirement already satisfied: notebook>=4.4.1 in /usr/local/lib/python3.7/dist-packages (from widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.3.1)\n",
"Requirement already satisfied: jupyter-core in /usr/local/lib/python3.7/dist-packages (from nbformat>=4.2.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (4.7.1)\n",
"Requirement already satisfied: pickleshare in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.7.5)\n",
"Requirement already satisfied: pexpect; sys_platform != \"win32\" in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (4.8.0)\n",
"Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.8.1)\n",
"Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.0.18)\n",
"Requirement already satisfied: pygments in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (2.6.1)\n",
"Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.7/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (57.2.0)\n",
"Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.7/dist-packages (from jupyter-client<7.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (22.1.0)\n",
"Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata<4; python_version < \"3.8.0\"->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.5.0)\n",
"Requirement already satisfied: nbconvert in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (5.6.1)\n",
"Requirement already satisfied: Send2Trash in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.7.1)\n",
"Requirement already satisfied: terminado>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.10.1)\n",
"Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.7/dist-packages (from pexpect; sys_platform != \"win32\"->ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.7.0)\n",
"Requirement already satisfied: wcwidth in /usr/local/lib/python3.7/dist-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.2.5)\n",
"Requirement already satisfied: defusedxml in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.7.1)\n",
"Requirement already satisfied: bleach in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (3.3.0)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (1.4.3)\n",
"Requirement already satisfied: testpath in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.5.0)\n",
"Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.7/dist-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.8.4)\n",
"Requirement already satisfied: webencodings in /usr/local/lib/python3.7/dist-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit!=0.84.0,>=0.73.0->streamlit-webrtc) (0.5.1)\n",
"Building wheels for collected packages: blinker\n",
" Building wheel for blinker (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for blinker: filename=blinker-1.4-cp37-none-any.whl size=13476 sha256=e232f2a62ec83115affe456f6cf82c8841e09ee746ab82cef3f3b2ecb71cd4c6\n",
" Stored in directory: /root/.cache/pip/wheels/92/a0/00/8690a57883956a301d91cf4ec999cc0b258b01e3f548f86e89\n",
"Successfully built blinker\n",
"\u001b[31mERROR: ipykernel 6.0.2 has requirement ipython<8.0,>=7.23.1, but you'll have ipython 5.5.0 which is incompatible.\u001b[0m\n",
"\u001b[31mERROR: google-colab 1.0.0 has requirement ipykernel~=4.10, but you'll have ipykernel 6.0.2 which is incompatible.\u001b[0m\n",
"Installing collected packages: google-crc32c, netifaces, dnspython, aioice, cryptography, pylibsrtp, pyee, av, aiortc, watchdog, smmap, gitdb, gitpython, base58, validators, importlib-metadata, ipykernel, pydeck, blinker, streamlit, streamlit-webrtc\n",
" Found existing installation: importlib-metadata 4.6.1\n",
" Uninstalling importlib-metadata-4.6.1:\n",
" Successfully uninstalled importlib-metadata-4.6.1\n",
" Found existing installation: ipykernel 4.10.1\n",
" Uninstalling ipykernel-4.10.1:\n",
" Successfully uninstalled ipykernel-4.10.1\n",
"Successfully installed aioice-0.7.5 aiortc-1.2.1 av-8.0.3 base58-2.1.0 blinker-1.4 cryptography-3.4.7 dnspython-2.1.0 gitdb-4.0.7 gitpython-3.1.18 google-crc32c-1.1.2 importlib-metadata-3.10.1 ipykernel-6.0.2 netifaces-0.11.0 pydeck-0.6.2 pyee-8.1.0 pylibsrtp-0.6.8 smmap-4.0.0 streamlit-0.84.1 streamlit-webrtc-0.24.0 validators-0.18.2 watchdog-2.1.3\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 1
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Un_r91s5Xt4E"
},
"source": [
"# Restart Runtime\n",
"# Ctrl + M"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "LefmCzamQ3o4",
"outputId": "d4d6aa03-36e7-437c-e0dc-d09c01cba399"
},
"source": [
"%%shell\n",
"pip install pydub"
],
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting pydub\n",
" Downloading https://files.pythonhosted.org/packages/a6/53/d78dc063216e62fc55f6b2eebb447f6a4b0a59f55c8406376f76bf959b08/pydub-0.25.1-py2.py3-none-any.whl\n",
"Installing collected packages: pydub\n",
"Successfully installed pydub-0.25.1\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 1
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 36
},
"id": "nEbOlzfGOqHU",
"outputId": "507e8bf5-9687-4ee8-cf07-95101d3dceee"
},
"source": [
"import streamlit as st\n",
"st.__version__"
],
"execution_count": 2,
"outputs": [
{
"output_type": "execute_result",
"data": {
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
},
"text/plain": [
"'0.84.1'"
]
},
"metadata": {
"tags": []
},
"execution_count": 2
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "7iUz6FVOOuvR",
"outputId": "e9692a9a-8a9e-44e5-f037-de90561432f2"
},
"source": [
"%%shell\n",
"wget \"https://raw.githubusercontent.com/whitphx/streamlit-webrtc-example/main/app.py\""
],
"execution_count": 3,
"outputs": [
{
"output_type": "stream",
"text": [
"--2021-07-19 15:25:52-- https://raw.githubusercontent.com/whitphx/streamlit-webrtc-example/main/app.py\n",
"Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...\n",
"Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 25637 (25K) [text/plain]\n",
"Saving to: ‘app.py’\n",
"\n",
"app.py 100%[===================>] 25.04K --.-KB/s in 0s \n",
"\n",
"2021-07-19 15:25:53 (125 MB/s) - ‘app.py’ saved [25637/25637]\n",
"\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 3
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IJfFjDPMUch2",
"outputId": "d8b8f51c-d7f9-4070-de07-00a6bbeca82e"
},
"source": [
"%%shell\n",
"nohup streamlit run app.py > streamlit.log 2>&1 & echo $! > streamlit.pid"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "6hu4r-sKO89K",
"outputId": "8f47edcc-a346-47f8-ed43-0a25c317ffeb"
},
"source": [
"%%shell\n",
"pgrep streamlit\n",
"ps -eaf | grep streamlit\n",
"#ps -p \"$(cat streamlit.pid)\""
],
"execution_count": 5,
"outputs": [
{
"output_type": "stream",
"text": [
"179\n",
"root 179 1 63 15:25 ? 00:00:01 /usr/bin/python3 /usr/local/bin/streamlit run app.py\n",
"root 190 127 0 15:25 ? 00:00:00 /bin/bash -c pgrep streamlit ps -eaf | grep streamlit #ps -p \"$(cat streamlit.pid)\"\n",
"root 193 190 0 15:25 ? 00:00:00 grep streamlit\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 5
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "m5H30ubJP2bb",
"outputId": "21e4bf77-9f09-4aa2-930c-993120e8d695"
},
"source": [
"%%shell\n",
"kill 179"
],
"execution_count": null,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 27
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "TLi-JBlz4Cqi"
},
"source": [
"## Deploy StreamlitApp use Google Colabs with Ngrok"
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "IbVNka5CIB8j",
"outputId": "56ba763d-da81-4afd-a97f-e3cea323d0db"
},
"source": [
"%%shell\n",
"wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip"
],
"execution_count": 6,
"outputs": [
{
"output_type": "stream",
"text": [
"--2021-07-19 15:26:10-- https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n",
"Resolving bin.equinox.io (bin.equinox.io)... 52.86.144.72, 3.213.165.59, 3.231.85.157, ...\n",
"Connecting to bin.equinox.io (bin.equinox.io)|52.86.144.72|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 13832437 (13M) [application/octet-stream]\n",
"Saving to: ‘ngrok-stable-linux-amd64.zip’\n",
"\n",
"ngrok-stable-linux- 100%[===================>] 13.19M 30.3MB/s in 0.4s \n",
"\n",
"2021-07-19 15:26:10 (30.3 MB/s) - ‘ngrok-stable-linux-amd64.zip’ saved [13832437/13832437]\n",
"\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 6
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "zGJnV1cMI6Ix",
"outputId": "3ddd1246-a090-4f02-828e-de008e1e05c1"
},
"source": [
"!unzip ngrok-stable-linux-amd64.zip"
],
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"text": [
"Archive: ngrok-stable-linux-amd64.zip\n",
" inflating: ngrok \n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Fc-f3iyVIogW",
"outputId": "8bc580d1-fcac-430f-9736-76238016da50"
},
"source": [
"%%shell\n",
"ls"
],
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"text": [
"app.py\tngrok\t\t\t sample_data streamlit.pid\n",
"models\tngrok-stable-linux-amd64.zip streamlit.log\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 8
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "-qKXtwa4K2kS"
},
"source": [
"get_ipython().system_raw('./ngrok http 8501 &')"
],
"execution_count": 9,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "MnPu70MKK1rJ",
"outputId": "a35fe6bc-53f9-47a3-cb4c-7cac72dccb7d"
},
"source": [
"!curl -s http://localhost:4040/api/tunnels | python3 -c \\\n",
" 'import sys, json; print(\"Execute the next cell and the go to the following URL: \" +json.load(sys.stdin)[\"tunnels\"][0][\"public_url\"])'"
],
"execution_count": 10,
"outputs": [
{
"output_type": "stream",
"text": [
"Execute the next cell and the go to the following URL: https://ff7bef1b28cb.ngrok.io\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "ESFqXBmwVX3x"
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment