|
61 | 61 | "source": [ |
62 | 62 | "### 0.1. Installing libraries and creating global variables for platform and working directory\n", |
63 | 63 | "\n", |
64 | | - "To run this notebook locally, you should create a virtual environment with the required libraries and set the `platform` variable to `local_notebook`. If you are running this notebook on Google Colab, set the `platform` variable to `colab`." |
| 64 | + "To run this notebook locally, you should create a virtual environment with the required libraries. If you are running this notebook on Google Colab, everything should be set." |
65 | 65 | ] |
66 | 66 | }, |
67 | 67 | { |
|
90 | 90 | "metadata": {}, |
91 | 91 | "outputs": [], |
92 | 92 | "source": [ |
93 | | - "platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}" |
| 93 | + "import os\n", |
| 94 | + "IN_COLAB = \"COLAB_GPU\" in os.environ" |
94 | 95 | ] |
95 | 96 | }, |
96 | 97 | { |
|
100 | 101 | "outputs": [], |
101 | 102 | "source": [ |
102 | 103 | "# Optional library to launch a streamlit app from colab\n", |
103 | | - "if platform == 'colab':\n", |
| 104 | + "if IN_COLAB:\n", |
104 | 105 | " !npm install localtunnel" |
105 | 106 | ] |
106 | 107 | }, |
|
148 | 149 | "from vuegen import report_generator\n", |
149 | 150 | "from vuegen.utils import get_logger, load_yaml_config\n", |
150 | 151 | "\n", |
151 | | - "if platform == 'colab':\n", |
| 152 | + "if IN_COLAB:\n", |
152 | 153 | " import urllib" |
153 | 154 | ] |
154 | 155 | }, |
|
1388 | 1389 | "metadata": {}, |
1389 | 1390 | "outputs": [], |
1390 | 1391 | "source": [ |
1391 | | - "# Launch the Streamlit report depneding on the platform\n", |
1392 | | - "#if platform == \"local_notebook\":\n", |
| 1392 | + "# # Launch the Streamlit report depneding on the platform\n", |
| 1393 | + "# if not IN_COLAB:\n", |
1393 | 1394 | "# !streamlit run streamlit_report/sections/report_manager.py\n", |
1394 | | - "#elif platform == \"colab\": # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
| 1395 | + "# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
1395 | 1396 | "# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
1396 | 1397 | "# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
1397 | 1398 | "# !npx localtunnel --port 8501" |
|
1567 | 1568 | "metadata": {}, |
1568 | 1569 | "outputs": [], |
1569 | 1570 | "source": [ |
1570 | | - "# Launch the Streamlit report depneding on the platform\n", |
1571 | | - "#if platform == \"local_notebook\":\n", |
| 1571 | + "# # Launch the Streamlit report depneding on the platform\n", |
| 1572 | + "# if not IN_COLAB:\n", |
1572 | 1573 | "# !streamlit run streamlit_report/sections/report_manager.py\n", |
1573 | | - "#elif platform == \"colab\":\n", |
| 1574 | + "# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n", |
1574 | 1575 | "# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
1575 | 1576 | "# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n", |
1576 | 1577 | "# !npx localtunnel --port 8501" |
|
0 commit comments