-
-
Save tuffacton/da5a9b42c0a2e9e355353689f93c84b3 to your computer and use it in GitHub Desktop.
| { | |
| "nbformat": 4, | |
| "nbformat_minor": 0, | |
| "metadata": { | |
| "colab": { | |
| "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": { | |
| "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" | |
| } | |
| ] | |
| } | |
| ] | |
| } |
i read so can you please provide me code how to run steamline which diplays "Hello world" in google colab
I guess you can only modify the codes after python -c
Running this code gives me this
This site can’t be reached
35.229.140.58 took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT
Hi, please just run all cells and only try to hit the URL from ngrok that's like so: http://377f47dc6ed1.ngrok.io
The IP of the colaboratory instance will not be exposed so you cannot hit those IPs.
Thank you, I'll try that! Could I bother you again if it doesn't work? (If you don't mind, of course )
…
On Tue, 23 Jun 2020, 7:10 pm Nic Acton, @.> wrote: @.* commented on this gist. ------------------------------ Hi, please just run all cells and only try to hit the URL from ngrok that's like so: http://377f47dc6ed1.ngrok.io The IP of the colaboratory instance will not be exposed so you cannot hit those IPs. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://gist.github.com/da5a9b42c0a2e9e355353689f93c84b3#gistcomment-3351739, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQ2FEUEXY5IYD3GRSJ6YGLRYDAUVANCNFSM4N6CSHIQ .
You can always leave a comment and I'll get to it when I can. Please try to be verbose with the steps you took and the errors you're seeing, maybe even a link to a Colaboratory notebook that you're running it in so the errors can be reproduced.
Wait. If I understand right. If I execute this code may I can use Streamlit on Google Colab? Is it?
Its the first time that I'll use Streamlit, as Data Scientist I can use matplotlib, pandas, etc, but seems very nice plot in Streamlit.
If you can help me with that, please I follow u on Instagram.
Ty, hugs from Brazil.
btw I have some colab here. u can see it. Can I use Streamlit on them? Ty mf.
btw I have some colab here. u can see it. Can I use Streamlit on them? Ty mf.
I took a quick look. I think you can make prototypes and develop with Streamlit on Colaboratory, but you wouldn't want to make that your production server as Colaboratory has a relatively short timeout (only about 12 hours). You can find more on how Streamlit could maybe fit with your projects here: https://www.streamlit.io/
Thank you so much for this brilliant piece of code.....👌👌
this is awesome thanks a lot
when I clicked on the URL it is showing me
"Tunnel f9b2788c5740.ngrok.io not found"
Hey m getting this error. could you help?
get_ipython().system_raw('./ngrok http 8501 &')
! curl -s http://localhost:4040/api/tunnels | python3 -c
"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"
error: Traceback (most recent call last):
File "", line 1, in
IndexError: list index out of range
when I clicked on the URL it is showing me
"Tunnel f9b2788c5740.ngrok.io not found"
Can you post a copy of your colaboratory notebook?
Hey m getting this error. could you help?
get_ipython().system_raw('./ngrok http 8501 &')
! curl -s http://localhost:4040/api/tunnels | python3 -c
"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])"error: Traceback (most recent call last):
File "", line 1, in
IndexError: list index out of range
Can you post a copy of your colaboratory notebook?
when I clicked on the URL it is showing me
"Tunnel f9b2788c5740.ngrok.io not found"Can you post a copy of your colaboratory notebook?
Thanks but this problem is solved. it was ngrok version issue
Legend..thanks for demystifying it on colab. Had totally hit a wall on my own..
Thanks guys! It can work in colab!
But i see some difference between run in colab and run in local.
When i run streamlit hello in local, I choose Animation Demo and run it. The Animation move move and move ...
But i run streamlit hello in colab like your code, I choose Animation Demo however the Animation don't move. only stand still
Why?
Thank you very much for this
Hey! I am getting this error when I try opening "https://2f10-35-196-239-11.ngrok.io/" this link. Please help.
The connection to https://2f10-35-196-239-11.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80.
Make sure that a web service is running on localhost:80 and that it is a valid address.
The error encountered was: dial tcp 127.0.0.1:80: connect: connection refused
Hey! I am getting this error when I try opening "https://2f10-35-196-239-11.ngrok.io/" this link. Please help.
The connection to https://2f10-35-196-239-11.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:80.
Make sure that a web service is running on localhost:80 and that it is a valid address.
The error encountered was: dial tcp 127.0.0.1:80: connect: connection refused
Can you post a copy of your Colaboratory Notebook?
I have the same problem as you. Did you solve it?@Aishwary-Rawal
I use VPN when I am using Colab. Is the problem related to this?
I could not use this way. the localhost refused. thus, i find the other way to solve it
npx create localtunnel and show the url to check in the browse
!streamlit run app.py & npx localtunnel --p 8501
https://youtu.be/zdJdJ1tHGnA , you can watch video for running streamlit in local hoast using localtunnel

i read so can you please provide me code how to run steamline which diplays "Hello world" in google colab