Skip to content

Commit 5340444

Browse files
committed
🎨 toogle streamlit app running in tutorial (especially for colab)
1 parent 0da2d29 commit 5340444

File tree

2 files changed

+76
-36
lines changed

2 files changed

+76
-36
lines changed

docs/vuegen_basic_case_study.ipynb

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
{
7575
"cell_type": "code",
76-
"execution_count": null,
76+
"execution_count": 1,
7777
"metadata": {},
7878
"outputs": [],
7979
"source": [
@@ -117,9 +117,21 @@
117117
},
118118
{
119119
"cell_type": "code",
120-
"execution_count": null,
120+
"execution_count": 2,
121121
"metadata": {},
122-
"outputs": [],
122+
"outputs": [
123+
{
124+
"ename": "ModuleNotFoundError",
125+
"evalue": "No module named 'vuegen'",
126+
"output_type": "error",
127+
"traceback": [
128+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
129+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
130+
"Cell \u001b[0;32mIn[2], line 4\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mos\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01myaml\u001b[39;00m\n\u001b[0;32m----> 4\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mvuegen\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m report_generator\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mvuegen\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m get_logger, load_yaml_config\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m IN_COLAB:\n",
131+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'vuegen'"
132+
]
133+
}
134+
],
123135
"source": [
124136
"# Imports\n",
125137
"import os\n",
@@ -169,15 +181,28 @@
169181
"cell_type": "code",
170182
"execution_count": null,
171183
"metadata": {},
172-
"outputs": [],
184+
"outputs": [
185+
{
186+
"name": "stdout",
187+
"output_type": "stream",
188+
"text": [
189+
"Streamlit report not executed, set run_streamlit to True to run the report\n"
190+
]
191+
}
192+
],
173193
"source": [
174-
"# # Launch the Streamlit report depneding on the platform\n",
175-
"# if not IN_COLAB:\n",
176-
"# !streamlit run streamlit_report/sections/report_manager.py\n",
177-
"# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
178-
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
179-
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
180-
"# !npx localtunnel --port 8501"
194+
"run_streamlit = False\n",
195+
"# run_streamlit = True # uncomment line to run the streamlit report\n",
196+
"# Launch the Streamlit report depneding on the platform\n",
197+
"if not IN_COLAB and run_streamlit:\n",
198+
" !streamlit run streamlit_report/sections/report_manager.py\n",
199+
"elif run_streamlit:\n",
200+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
201+
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
202+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
203+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
204+
"else:\n",
205+
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
181206
]
182207
},
183208
{
@@ -314,13 +339,18 @@
314339
"metadata": {},
315340
"outputs": [],
316341
"source": [
317-
"# # Launch the Streamlit report depneding on the platform\n",
318-
"# if not IN_COLAB:\n",
319-
"# !streamlit run streamlit_report/sections/report_manager.py\n",
320-
"# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
321-
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
322-
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
323-
"# !npx localtunnel --port 8501"
342+
"run_streamlit = False\n",
343+
"# run_streamlit = True # uncomment line to run the streamlit report\n",
344+
"# Launch the Streamlit report depneding on the platform\n",
345+
"if not IN_COLAB and run_streamlit:\n",
346+
" !streamlit run streamlit_report/sections/report_manager.py\n",
347+
"elif run_streamlit:\n",
348+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
349+
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
350+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
351+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
352+
"else:\n",
353+
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
324354
]
325355
},
326356
{
@@ -344,7 +374,7 @@
344374
],
345375
"metadata": {
346376
"kernelspec": {
347-
"display_name": "vuegen-IFxaxej_-py3.12",
377+
"display_name": "vuegen",
348378
"language": "python",
349379
"name": "python3"
350380
},
@@ -358,7 +388,7 @@
358388
"name": "python",
359389
"nbconvert_exporter": "python",
360390
"pygments_lexer": "ipython3",
361-
"version": "3.12.6"
391+
"version": "3.9.21"
362392
}
363393
},
364394
"nbformat": 4,

docs/vuegen_case_study_earth_microbiome.ipynb

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,13 +1389,18 @@
13891389
"metadata": {},
13901390
"outputs": [],
13911391
"source": [
1392-
"# # Launch the Streamlit report depneding on the platform\n",
1393-
"# if not IN_COLAB:\n",
1394-
"# !streamlit run streamlit_report/sections/report_manager.py\n",
1395-
"# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
1396-
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
1397-
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
1398-
"# !npx localtunnel --port 8501"
1392+
"run_streamlit = False\n",
1393+
"# run_streamlit = True # uncomment line to run the streamlit report\n",
1394+
"# Launch the Streamlit report depneding on the platform\n",
1395+
"if not IN_COLAB and run_streamlit:\n",
1396+
" !streamlit run streamlit_report/sections/report_manager.py\n",
1397+
"elif run_streamlit:\n",
1398+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
1399+
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
1400+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
1401+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
1402+
"else:\n",
1403+
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
13991404
]
14001405
},
14011406
{
@@ -1568,13 +1573,18 @@
15681573
"metadata": {},
15691574
"outputs": [],
15701575
"source": [
1571-
"# # Launch the Streamlit report depneding on the platform\n",
1572-
"# if not IN_COLAB:\n",
1573-
"# !streamlit run streamlit_report/sections/report_manager.py\n",
1574-
"# else: # https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
1575-
"# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
1576-
"# !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
1577-
"# !npx localtunnel --port 8501"
1576+
"run_streamlit = False\n",
1577+
"# run_streamlit = True # uncomment line to run the streamlit report\n",
1578+
"# Launch the Streamlit report depneding on the platform\n",
1579+
"if not IN_COLAB and run_streamlit:\n",
1580+
" !streamlit run streamlit_report/sections/report_manager.py\n",
1581+
"elif run_streamlit:\n",
1582+
" # see: https://discuss.streamlit.io/t/how-to-launch-streamlit-app-from-google-colab-notebook/42399\n",
1583+
" print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n",
1584+
" !streamlit run streamlit_report/sections/report_manager.py --server.address=localhost &>/content/logs.txt &\n",
1585+
" !npx localtunnel --port 8501 --subdomain vuegen-demo\n",
1586+
"else:\n",
1587+
" print(\"Streamlit report not executed, set run_streamlit to True to run the report\")"
15781588
]
15791589
},
15801590
{
@@ -1598,7 +1608,7 @@
15981608
],
15991609
"metadata": {
16001610
"kernelspec": {
1601-
"display_name": "vuegen-IFxaxej_-py3.12",
1611+
"display_name": "vuegen",
16021612
"language": "python",
16031613
"name": "python3"
16041614
},
@@ -1612,7 +1622,7 @@
16121622
"name": "python",
16131623
"nbconvert_exporter": "python",
16141624
"pygments_lexer": "ipython3",
1615-
"version": "3.12.6"
1625+
"version": "3.9.21"
16161626
}
16171627
},
16181628
"nbformat": 4,

0 commit comments

Comments
 (0)