Anthony Truchet commited on
Commit
78f0ef0
·
1 Parent(s): 9563733

fix: forcefully add the exemples

Browse files

TODO: reactivate jupytext which breaks on Hugging Face environment

jupyter/notebooks/ex_autoreload.ipynb ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "attachments": {},
5
+ "cell_type": "markdown",
6
+ "id": "30f034a5",
7
+ "metadata": {},
8
+ "source": [
9
+ "# Automatic reloading example for interactive development\n"
10
+ ]
11
+ },
12
+ {
13
+ "cell_type": "code",
14
+ "execution_count": 1,
15
+ "id": "98f2f3f8",
16
+ "metadata": {
17
+ "lines_to_next_cell": 2
18
+ },
19
+ "outputs": [],
20
+ "source": [
21
+ "%load_ext autoreload\n",
22
+ "%autoreload 1"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "code",
27
+ "execution_count": 2,
28
+ "id": "14acf530",
29
+ "metadata": {},
30
+ "outputs": [
31
+ {
32
+ "name": "stdout",
33
+ "output_type": "stream",
34
+ "text": [
35
+ "executing the file '/opt/code/athai/hello.py'in module 'athai.hello' and package 'athai'\n"
36
+ ]
37
+ }
38
+ ],
39
+ "source": [
40
+ "%aimport athai.hello"
41
+ ]
42
+ },
43
+ {
44
+ "attachments": {},
45
+ "cell_type": "markdown",
46
+ "id": "f8be4aa9",
47
+ "metadata": {},
48
+ "source": []
49
+ },
50
+ {
51
+ "cell_type": "code",
52
+ "execution_count": 3,
53
+ "id": "d06a304c-912f-4bde-add3-5cf1c5400afb",
54
+ "metadata": {},
55
+ "outputs": [],
56
+ "source": [
57
+ "from athai import hello"
58
+ ]
59
+ },
60
+ {
61
+ "cell_type": "code",
62
+ "execution_count": 4,
63
+ "id": "7568bd54-1c4e-449a-8edd-3659d7ec891f",
64
+ "metadata": {},
65
+ "outputs": [
66
+ {
67
+ "data": {
68
+ "text/plain": [
69
+ "'Nice to meet you, Jae!'"
70
+ ]
71
+ },
72
+ "execution_count": 4,
73
+ "metadata": {},
74
+ "output_type": "execute_result"
75
+ }
76
+ ],
77
+ "source": [
78
+ "hello.build_greetings(\"Jae\")"
79
+ ]
80
+ },
81
+ {
82
+ "cell_type": "code",
83
+ "execution_count": null,
84
+ "id": "11ef3094-570c-46a2-9beb-30153d599b6d",
85
+ "metadata": {},
86
+ "outputs": [],
87
+ "source": []
88
+ },
89
+ {
90
+ "cell_type": "code",
91
+ "execution_count": null,
92
+ "id": "603e6d0a-c706-420b-bb33-920952f797de",
93
+ "metadata": {},
94
+ "outputs": [],
95
+ "source": []
96
+ }
97
+ ],
98
+ "metadata": {
99
+ "kernelspec": {
100
+ "display_name": "Python 3 (ipykernel)",
101
+ "language": "python",
102
+ "name": "python3"
103
+ },
104
+ "language_info": {
105
+ "codemirror_mode": {
106
+ "name": "ipython",
107
+ "version": 3
108
+ },
109
+ "file_extension": ".py",
110
+ "mimetype": "text/x-python",
111
+ "name": "python",
112
+ "nbconvert_exporter": "python",
113
+ "pygments_lexer": "ipython3",
114
+ "version": "3.10.12"
115
+ }
116
+ },
117
+ "nbformat": 4,
118
+ "nbformat_minor": 5
119
+ }
jupyter/notebooks/test_persistent_data.ipynb ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "b107913b-6509-4e81-910c-d85c6b2d21a0",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "import os\n",
11
+ "from pathlib import Path\n",
12
+ "\n",
13
+ "import numpy as np\n",
14
+ "import pandas as pd"
15
+ ]
16
+ },
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 2,
20
+ "id": "101058a0-be75-469e-888e-ca30085b3728",
21
+ "metadata": {},
22
+ "outputs": [],
23
+ "source": [
24
+ "from athai.data_utils import cached_download_csv"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 3,
30
+ "id": "ff4bfe45-7c3a-4f2a-8bb1-1c0949e59439",
31
+ "metadata": {},
32
+ "outputs": [],
33
+ "source": [
34
+ "DATE_COLUMN = \"date/time\"\n",
35
+ "DATA_URL = (\n",
36
+ " \"https://s3-us-west-2.amazonaws.com/\"\n",
37
+ " \"streamlit-demo-data/uber-raw-data-sep14.csv.gz\"\n",
38
+ ")\n",
39
+ "\n",
40
+ "DATA_PATH = Path(os.environ.get(\"APP_DATA\"))\n"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": 4,
46
+ "id": "740320f0-ac83-4a7b-8087-f930e9e43da4",
47
+ "metadata": {},
48
+ "outputs": [
49
+ {
50
+ "name": "stderr",
51
+ "output_type": "stream",
52
+ "text": [
53
+ "INFO:root:Opened or created the shelf file '/data/app/shelf.dat'\n",
54
+ "INFO:root:Re-using cached URL 'https://s3-us-west-2.amazonaws.com/streamlit-demo-data/uber-raw-data-sep14.csv.gz'\n"
55
+ ]
56
+ },
57
+ {
58
+ "data": {
59
+ "text/html": [
60
+ "<div>\n",
61
+ "<style scoped>\n",
62
+ " .dataframe tbody tr th:only-of-type {\n",
63
+ " vertical-align: middle;\n",
64
+ " }\n",
65
+ "\n",
66
+ " .dataframe tbody tr th {\n",
67
+ " vertical-align: top;\n",
68
+ " }\n",
69
+ "\n",
70
+ " .dataframe thead th {\n",
71
+ " text-align: right;\n",
72
+ " }\n",
73
+ "</style>\n",
74
+ "<table border=\"1\" class=\"dataframe\">\n",
75
+ " <thead>\n",
76
+ " <tr style=\"text-align: right;\">\n",
77
+ " <th></th>\n",
78
+ " <th>Date/Time</th>\n",
79
+ " <th>Lat</th>\n",
80
+ " <th>Lon</th>\n",
81
+ " <th>Base</th>\n",
82
+ " </tr>\n",
83
+ " </thead>\n",
84
+ " <tbody>\n",
85
+ " <tr>\n",
86
+ " <th>0</th>\n",
87
+ " <td>9/1/2014 0:01:00</td>\n",
88
+ " <td>40.2201</td>\n",
89
+ " <td>-74.0021</td>\n",
90
+ " <td>B02512</td>\n",
91
+ " </tr>\n",
92
+ " <tr>\n",
93
+ " <th>1</th>\n",
94
+ " <td>9/1/2014 0:01:00</td>\n",
95
+ " <td>40.7500</td>\n",
96
+ " <td>-74.0027</td>\n",
97
+ " <td>B02512</td>\n",
98
+ " </tr>\n",
99
+ " <tr>\n",
100
+ " <th>2</th>\n",
101
+ " <td>9/1/2014 0:03:00</td>\n",
102
+ " <td>40.7559</td>\n",
103
+ " <td>-73.9864</td>\n",
104
+ " <td>B02512</td>\n",
105
+ " </tr>\n",
106
+ " <tr>\n",
107
+ " <th>3</th>\n",
108
+ " <td>9/1/2014 0:06:00</td>\n",
109
+ " <td>40.7450</td>\n",
110
+ " <td>-73.9889</td>\n",
111
+ " <td>B02512</td>\n",
112
+ " </tr>\n",
113
+ " <tr>\n",
114
+ " <th>4</th>\n",
115
+ " <td>9/1/2014 0:11:00</td>\n",
116
+ " <td>40.8145</td>\n",
117
+ " <td>-73.9444</td>\n",
118
+ " <td>B02512</td>\n",
119
+ " </tr>\n",
120
+ " <tr>\n",
121
+ " <th>5</th>\n",
122
+ " <td>9/1/2014 0:12:00</td>\n",
123
+ " <td>40.6735</td>\n",
124
+ " <td>-73.9918</td>\n",
125
+ " <td>B02512</td>\n",
126
+ " </tr>\n",
127
+ " <tr>\n",
128
+ " <th>6</th>\n",
129
+ " <td>9/1/2014 0:15:00</td>\n",
130
+ " <td>40.7471</td>\n",
131
+ " <td>-73.6472</td>\n",
132
+ " <td>B02512</td>\n",
133
+ " </tr>\n",
134
+ " <tr>\n",
135
+ " <th>7</th>\n",
136
+ " <td>9/1/2014 0:16:00</td>\n",
137
+ " <td>40.6613</td>\n",
138
+ " <td>-74.2691</td>\n",
139
+ " <td>B02512</td>\n",
140
+ " </tr>\n",
141
+ " <tr>\n",
142
+ " <th>8</th>\n",
143
+ " <td>9/1/2014 0:32:00</td>\n",
144
+ " <td>40.3745</td>\n",
145
+ " <td>-73.9999</td>\n",
146
+ " <td>B02512</td>\n",
147
+ " </tr>\n",
148
+ " <tr>\n",
149
+ " <th>9</th>\n",
150
+ " <td>9/1/2014 0:33:00</td>\n",
151
+ " <td>40.7633</td>\n",
152
+ " <td>-73.9773</td>\n",
153
+ " <td>B02512</td>\n",
154
+ " </tr>\n",
155
+ " </tbody>\n",
156
+ "</table>\n",
157
+ "</div>"
158
+ ],
159
+ "text/plain": [
160
+ " Date/Time Lat Lon Base\n",
161
+ "0 9/1/2014 0:01:00 40.2201 -74.0021 B02512\n",
162
+ "1 9/1/2014 0:01:00 40.7500 -74.0027 B02512\n",
163
+ "2 9/1/2014 0:03:00 40.7559 -73.9864 B02512\n",
164
+ "3 9/1/2014 0:06:00 40.7450 -73.9889 B02512\n",
165
+ "4 9/1/2014 0:11:00 40.8145 -73.9444 B02512\n",
166
+ "5 9/1/2014 0:12:00 40.6735 -73.9918 B02512\n",
167
+ "6 9/1/2014 0:15:00 40.7471 -73.6472 B02512\n",
168
+ "7 9/1/2014 0:16:00 40.6613 -74.2691 B02512\n",
169
+ "8 9/1/2014 0:32:00 40.3745 -73.9999 B02512\n",
170
+ "9 9/1/2014 0:33:00 40.7633 -73.9773 B02512"
171
+ ]
172
+ },
173
+ "execution_count": 4,
174
+ "metadata": {},
175
+ "output_type": "execute_result"
176
+ }
177
+ ],
178
+ "source": [
179
+ "nrows=10\n",
180
+ "data = cached_download_csv(DATA_PATH, DATA_URL, nrows=nrows)\n",
181
+ "data"
182
+ ]
183
+ },
184
+ {
185
+ "cell_type": "code",
186
+ "execution_count": null,
187
+ "id": "35a636c3-a1cd-40df-8bd2-9f008046a99f",
188
+ "metadata": {},
189
+ "outputs": [],
190
+ "source": []
191
+ },
192
+ {
193
+ "cell_type": "code",
194
+ "execution_count": null,
195
+ "id": "a2dfa021-231c-4fcb-9928-66e69ef802d5",
196
+ "metadata": {},
197
+ "outputs": [],
198
+ "source": []
199
+ }
200
+ ],
201
+ "metadata": {
202
+ "kernelspec": {
203
+ "display_name": "Python 3 (ipykernel)",
204
+ "language": "python",
205
+ "name": "python3"
206
+ },
207
+ "language_info": {
208
+ "codemirror_mode": {
209
+ "name": "ipython",
210
+ "version": 3
211
+ },
212
+ "file_extension": ".py",
213
+ "mimetype": "text/x-python",
214
+ "name": "python",
215
+ "nbconvert_exporter": "python",
216
+ "pygments_lexer": "ipython3",
217
+ "version": "3.10.12"
218
+ }
219
+ },
220
+ "nbformat": 4,
221
+ "nbformat_minor": 5
222
+ }