Last active
March 7, 2024 05:47
Revisions
-
tuffacton revised this gist
May 7, 2020 . No changes.There are no files selected for viewing
-
tuffacton revised this gist
May 7, 2020 . 1 changed file with 12 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,14 +6,25 @@ "name": "streamlit_colab", "provenance": [], "collapsed_sections": [], "toc_visible": true, "include_colab_link": true }, "kernelspec": { "display_name": "Python 3", "name": "python3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "<a href=\"https://colab.research.google.com/gist/tuffacton/da5a9b42c0a2e9e355353689f93c84b3/streamlit_colab.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" ] }, { "cell_type": "markdown", "metadata": { -
tuffacton created this gist
May 7, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,158 @@ { "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "streamlit_colab", "provenance": [], "collapsed_sections": [], "toc_visible": true }, "kernelspec": { "display_name": "Python 3", "name": "python3" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "YueD6bxr_Ndx", "colab_type": "text" }, "source": [ "Run all of the following to start the Streamlit demo!\n", "\n", "Modify with the [docs](https://docs.streamlit.io/) to prototype your own ML apps." ] }, { "cell_type": "code", "metadata": { "id": "cPxfsHGb5_xh", "colab_type": "code", "colab": {} }, "source": [ "!pip install streamlit -q" ], "execution_count": 0, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "GC3gSHfd6J9y", "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", "height": 230 }, "outputId": "b2397e92-84cf-4b70-b4b3-c36c45d17341" }, "source": [ "!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n", "!unzip -qq ngrok-stable-linux-amd64.zip" ], "execution_count": 2, "outputs": [ { "output_type": "stream", "text": [ "--2020-05-07 02:33:23-- https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n", "Resolving bin.equinox.io (bin.equinox.io)... 34.196.227.130, 34.194.73.153, 34.235.226.28, ...\n", "Connecting to bin.equinox.io (bin.equinox.io)|34.196.227.130|:443... connected.\n", "HTTP request sent, awaiting response... 200 OK\n", "Length: 13773305 (13M) [application/octet-stream]\n", "Saving to: ‘ngrok-stable-linux-amd64.zip.2’\n", "\n", "\r ngrok-sta 0%[ ] 0 --.-KB/s \rngrok-stable-linux- 100%[===================>] 13.13M 73.9MB/s in 0.2s \n", "\n", "2020-05-07 02:33:23 (73.9 MB/s) - ‘ngrok-stable-linux-amd64.zip.2’ saved [13773305/13773305]\n", "\n", "replace ngrok? [y]es, [n]o, [A]ll, [N]one, [r]ename: A\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "oE8YZYsk-UGs", "colab_type": "text" }, "source": [ "**Use the output of this command as the link to your Streamlit app.**" ] }, { "cell_type": "code", "metadata": { "id": "XMOoOLFT88ku", "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", "height": 34 }, "outputId": "abd49142-668b-405e-b172-8bd235b9ad86" }, "source": [ "get_ipython().system_raw('./ngrok http 8501 &')\n", "! curl -s http://localhost:4040/api/tunnels | python3 -c \\\n", " \"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])\"" ], "execution_count": 3, "outputs": [ { "output_type": "stream", "text": [ "http://e3b5ec48.ngrok.io\n" ], "name": "stdout" } ] }, { "cell_type": "markdown", "metadata": { "id": "SdNVtkKn-l-z", "colab_type": "text" }, "source": [ "**Ignore the output of this**" ] }, { "cell_type": "code", "metadata": { "id": "rUHzaig59IQ_", "colab_type": "code", "colab": { "base_uri": "https://localhost:8080/", "height": 141 }, "outputId": "84ac4c0f-4314-4652-e1f9-23d591af0073" }, "source": [ "!streamlit hello" ], "execution_count": 4, "outputs": [ { "output_type": "stream", "text": [ "\u001b[0m\n", "\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n", "\u001b[0m\n", "\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.2:8501\u001b[0m\n", "\u001b[34m External URL: \u001b[0m\u001b[1mhttp://35.243.143.25:8501\u001b[0m\n", "\u001b[0m\n", "\u001b[34m Stopping...\u001b[0m\n" ], "name": "stdout" } ] } ] }