Skip to content

Commit 57f676f

Browse files
committed
Update apps
1 parent 2841b02 commit 57f676f

File tree

9 files changed

+12009
-14
lines changed

9 files changed

+12009
-14
lines changed

examples/advanced-component-usage/toast.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def make_toast(message):
102102
is_open=True,
103103
dismissable=True,
104104
icon="danger",
105+
className="mb-2",
105106
)
106107

107108

examples/gallery/faithful/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import plotly.figure_factory as ff
1515
from dash import Input, Output, dcc, html
1616

17-
DATA = pd.read_csv("https://cdn.opensource.faculty.ai/old-faithful/data.csv")
17+
DATA = pd.read_csv("data.csv")
1818

1919
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
2020

examples/gallery/faithful/data.csv

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
eruptions,waiting
2+
3.6,79
3+
1.8,54
4+
3.333,74
5+
2.283,62
6+
4.533,85
7+
2.883,55
8+
4.7,88
9+
3.6,85
10+
1.95,51
11+
4.35,85
12+
1.8330000000000002,54
13+
3.917,84
14+
4.2,78
15+
1.75,47
16+
4.7,83
17+
2.167,52
18+
1.75,62
19+
4.8,84
20+
1.6,52
21+
4.25,79
22+
1.8,51
23+
1.75,47
24+
3.45,78
25+
3.0669999999999997,69
26+
4.533,74
27+
3.6,83
28+
1.9669999999999999,55
29+
4.083,76
30+
3.85,78
31+
4.433,79
32+
4.3,73
33+
4.467,77
34+
3.367,66
35+
4.033,80
36+
3.833,74
37+
2.017,52
38+
1.867,48
39+
4.833,80
40+
1.8330000000000002,59
41+
4.783,90
42+
4.35,80
43+
1.883,58
44+
4.567,84
45+
1.75,58
46+
4.533,73
47+
3.3169999999999997,83
48+
3.833,64
49+
2.1,53
50+
4.633,82
51+
2.0,59
52+
4.8,75
53+
4.716,90
54+
1.8330000000000002,54
55+
4.833,80
56+
1.733,54
57+
4.883,83
58+
3.717,71
59+
1.6669999999999998,64
60+
4.567,77
61+
4.317,81
62+
2.233,59
63+
4.5,84
64+
1.75,48
65+
4.8,82
66+
1.817,60
67+
4.4,92
68+
4.167,78
69+
4.7,78
70+
2.0669999999999997,65
71+
4.7,73
72+
4.033,82
73+
1.9669999999999999,56
74+
4.5,79
75+
4.0,71
76+
1.983,62
77+
5.067,76
78+
2.017,60
79+
4.567,78
80+
3.883,76
81+
3.6,83
82+
4.133,75
83+
4.333,82
84+
4.1,70
85+
2.633,65
86+
4.067,73
87+
4.933,88
88+
3.95,76
89+
4.5169999999999995,80
90+
2.167,48
91+
4.0,86
92+
2.2,60
93+
4.333,90
94+
1.867,50
95+
4.817,78
96+
1.8330000000000002,63
97+
4.3,72
98+
4.667,84
99+
3.75,75
100+
1.867,51
101+
4.9,82
102+
2.483,62
103+
4.367,88
104+
2.1,49
105+
4.5,83
106+
4.05,81
107+
1.867,47
108+
4.7,84
109+
1.7830000000000001,52
110+
4.85,86
111+
3.6830000000000003,81
112+
4.7330000000000005,75
113+
2.3,59
114+
4.9,89
115+
4.417,79
116+
1.7,59
117+
4.633,81
118+
2.3169999999999997,50
119+
4.6,85
120+
1.817,59
121+
4.417,87
122+
2.617,53
123+
4.067,69
124+
4.25,77
125+
1.9669999999999999,56
126+
4.6,88
127+
3.767,81
128+
1.9169999999999998,45
129+
4.5,82
130+
2.267,55
131+
4.65,90
132+
1.867,45
133+
4.167,83
134+
2.8,56
135+
4.333,89
136+
1.8330000000000002,46
137+
4.383,82
138+
1.883,51
139+
4.933,86
140+
2.033,53
141+
3.733,79
142+
4.2330000000000005,81
143+
2.233,60
144+
4.533,82
145+
4.817,77
146+
4.333,76
147+
1.983,59
148+
4.633,80
149+
2.017,49
150+
5.1,96
151+
1.8,53
152+
5.033,77
153+
4.0,77
154+
2.4,65
155+
4.6,81
156+
3.5669999999999997,71
157+
4.0,70
158+
4.5,81
159+
4.083,93
160+
1.8,53
161+
3.967,89
162+
2.2,45
163+
4.15,86
164+
2.0,58
165+
3.833,78
166+
3.5,66
167+
4.583,76
168+
2.367,63
169+
5.0,88
170+
1.933,52
171+
4.617,93
172+
1.9169999999999998,49
173+
2.083,57
174+
4.583,77
175+
3.333,68
176+
4.167,81
177+
4.333,81
178+
4.5,73
179+
2.417,50
180+
4.0,85
181+
4.167,74
182+
1.883,55
183+
4.583,77
184+
4.25,83
185+
3.767,83
186+
2.033,51
187+
4.433,78
188+
4.083,84
189+
1.8330000000000002,46
190+
4.417,83
191+
2.1830000000000003,55
192+
4.8,81
193+
1.8330000000000002,57
194+
4.8,76
195+
4.1,84
196+
3.966,77
197+
4.2330000000000005,81
198+
3.5,87
199+
4.3660000000000005,77
200+
2.25,51
201+
4.667,78
202+
2.1,60
203+
4.35,82
204+
4.133,91
205+
1.867,53
206+
4.6,78
207+
1.7830000000000001,46
208+
4.367,77
209+
3.85,84
210+
1.933,49
211+
4.5,83
212+
2.383,71
213+
4.7,80
214+
1.867,49
215+
3.833,75
216+
3.417,64
217+
4.2330000000000005,76
218+
2.4,53
219+
4.8,94
220+
2.0,55
221+
4.15,76
222+
1.867,50
223+
4.2669999999999995,82
224+
1.75,54
225+
4.4830000000000005,75
226+
4.0,78
227+
4.117,79
228+
4.083,78
229+
4.2669999999999995,78
230+
3.917,70
231+
4.55,79
232+
4.083,70
233+
2.417,54
234+
4.183,86
235+
2.217,50
236+
4.45,90
237+
1.883,54
238+
1.85,54
239+
4.283,77
240+
3.95,79
241+
2.333,64
242+
4.15,75
243+
2.35,47
244+
4.933,86
245+
2.9,63
246+
4.583,85
247+
3.833,82
248+
2.083,57
249+
4.367,82
250+
2.133,67
251+
4.35,74
252+
2.2,54
253+
4.45,83
254+
3.5669999999999997,73
255+
4.5,73
256+
4.15,88
257+
3.8169999999999997,80
258+
3.917,71
259+
4.45,83
260+
2.0,56
261+
4.283,79
262+
4.7669999999999995,78
263+
4.533,84
264+
1.85,58
265+
4.25,83
266+
1.983,43
267+
2.25,60
268+
4.75,75
269+
4.117,81
270+
2.15,46
271+
4.417,90
272+
1.817,46
273+
4.467,74

examples/gallery/telephones-by-region/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import plotly.graph_objs as go
1111
from dash import Input, Output, dcc, html
1212

13-
data = pd.read_csv("https://cdn.opensource.faculty.ai/world-phones/data.csv")
13+
data = pd.read_csv("data.csv")
1414

1515
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
1616

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Year,N.Amer,Europe,Asia,S.Amer,Oceania,Africa,Mid.Amer
2+
1951,45939,21574,2876,1815,1646,89,555
3+
1956,60423,29990,4708,2568,2366,1411,733
4+
1957,64721,32510,5230,2695,2526,1546,773
5+
1958,68484,35218,6662,2845,2691,1663,836
6+
1959,71799,37598,6856,3000,2868,1769,911
7+
1960,76036,40341,8220,3145,3054,1905,1008
8+
1961,79831,43173,9053,3338,3224,2005,1076

examples/gallery/wordcloud/app.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,27 @@
66

77
import base64
88
import io
9-
from functools import lru_cache
10-
from urllib.request import urlopen
9+
from functools import cache
1110

1211
import dash
1312
import dash_bootstrap_components as dbc
1413
from dash import Input, Output, dcc, html
1514
from wordcloud import WordCloud
1615

17-
BASE_URL = "https://cdn.opensource.faculty.ai/wordcloud"
18-
19-
DOCUMENT_URLS = {
20-
"midsummer": f"{BASE_URL}/a-midsummer-nights-dream.txt",
21-
"venice": f"{BASE_URL}/the-merchant-of-venice.txt",
22-
"randj": f"{BASE_URL}/romeo-and-juliet.txt",
16+
DOCUMENT_PATHS = {
17+
"midsummer": "data/a-midsummer-nights-dream.txt",
18+
"venice": "data/the-merchant-of-venice.txt",
19+
"randj": "data/romeo-and-juliet.txt",
2320
}
2421

2522

2623
# use lru_cache to memoise the frequencies
27-
@lru_cache(maxsize=3)
24+
@cache
2825
def load_word_frequencies(book):
29-
url = DOCUMENT_URLS[book]
26+
path = DOCUMENT_PATHS[book]
3027
WC = WordCloud(width=1000, height=600)
31-
with urlopen(url) as f:
32-
text = f.read().decode("utf-8")
28+
with open(path) as f:
29+
text = f.read()
3330
return WC.process_text(text)
3431

3532

@@ -104,6 +101,7 @@ def load_word_frequencies(book):
104101
],
105102
)
106103
def make_wordcloud(book, min_freq, max_vocab):
104+
print(book)
107105
# filter frequencies based on min_freq and max_vocab
108106
sorted_frequencies = sorted(
109107
load_word_frequencies(book).items(), key=lambda x: x[1], reverse=True

0 commit comments

Comments
 (0)