|
54 | 54 | "source": [ |
55 | 55 | "### 0.1. Installing libraries and creating global variables for platform and working directory\n", |
56 | 56 | "\n", |
57 | | - "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`." |
| 57 | + "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." |
58 | 58 | ] |
59 | 59 | }, |
60 | 60 | { |
61 | 61 | "cell_type": "code", |
62 | 62 | "execution_count": null, |
63 | | - "metadata": {}, |
| 63 | + "metadata": { |
| 64 | + "tags": [ |
| 65 | + "hide-output" |
| 66 | + ] |
| 67 | + }, |
64 | 68 | "outputs": [], |
65 | 69 | "source": [ |
66 | 70 | "# Vuegen library \n", |
|
73 | 77 | "metadata": {}, |
74 | 78 | "outputs": [], |
75 | 79 | "source": [ |
76 | | - "platform = 'local_notebook' #@param ['colab', 'local_notebook'] {allow-input: true}" |
| 80 | + "IN_COLAB = \"COLAB_GPU\" in os.environ" |
77 | 81 | ] |
78 | 82 | }, |
79 | 83 | { |
|
83 | 87 | "outputs": [], |
84 | 88 | "source": [ |
85 | 89 | "# Set working directory\n", |
86 | | - "if platform == 'colab':\n", |
| 90 | + "if IN_COLAB:\n", |
87 | 91 | " # Clone the repository in Colab\n", |
88 | 92 | " !git clone --depth=1 https://github.com/Multiomics-Analytics-Group/vuegen.git\n", |
89 | 93 | " base_output_dir = \"vuegen/docs/example_data/Basic_example_vuegen_demo_notebook/\"\n", |
90 | | - "elif platform == 'local_notebook':\n", |
| 94 | + "else:\n", |
91 | 95 | " # Output directory for local execution\n", |
92 | 96 | " base_output_dir = \"./example_data/Basic_example_vuegen_demo_notebook/\"" |
93 | 97 | ] |
|
99 | 103 | "outputs": [], |
100 | 104 | "source": [ |
101 | 105 | "# Optional library to launch a streamlit app from colab\n", |
102 | | - "if platform == 'colab':\n", |
| 106 | + "if IN_COLAB:\n", |
103 | 107 | " !npm install localtunnel" |
104 | 108 | ] |
105 | 109 | }, |
|
112 | 116 | }, |
113 | 117 | { |
114 | 118 | "cell_type": "code", |
115 | | - "execution_count": 27, |
| 119 | + "execution_count": null, |
116 | 120 | "metadata": {}, |
117 | 121 | "outputs": [], |
118 | 122 | "source": [ |
|
122 | 126 | "from vuegen import report_generator\n", |
123 | 127 | "from vuegen.utils import get_logger, load_yaml_config\n", |
124 | 128 | "\n", |
125 | | - "if platform == 'colab':\n", |
| 129 | + "if IN_COLAB:\n", |
126 | 130 | " import urllib" |
127 | 131 | ] |
128 | 132 | }, |
|
310 | 314 | "outputs": [], |
311 | 315 | "source": [ |
312 | 316 | "# Launch the Streamlit report depneding on the platform\n", |
313 | | - "#if platform == \"local_notebook\":\n", |
| 317 | + "#if not IN_COLAB:\n", |
314 | 318 | "# !streamlit run streamlit_report/sections/report_manager.py\n", |
315 | 319 | "#elif platform == \"colab\":\n", |
316 | 320 | "# print(\"Password/Enpoint IP for localtunnel is:\",urllib.request.urlopen('https://ipv4.icanhazip.com').read().decode('utf8').strip(\"\\n\"))\n", |
|
0 commit comments