omkarenator commited on
Commit
67f6eb3
·
1 Parent(s): 80fdb1e

apply distill correctly

Browse files
Files changed (2) hide show
  1. main.py +28 -14
  2. style.css +233 -39
main.py CHANGED
@@ -1,5 +1,7 @@
1
  from fasthtml_hf import setup_hf_backup
2
  from fasthtml.common import *
 
 
3
 
4
 
5
  app, rt = fast_app()
@@ -11,24 +13,37 @@ def get():
11
  Head(
12
  Meta(charset="UTF-8"),
13
  Meta(name="viewport", content="width=device-width, initial-scale=1.0"),
14
- Title("Simple Blog Post", cls="d-title"),
15
  Link(rel="stylesheet", href="style.css"),
16
- Script(src="https://distill.pub/template.v1.js"),
17
  ),
18
  Body(
19
- Div(
20
- Aside(
21
- H2("Table of Contents"),
22
- Ul(
23
- Li(A("Introduction", href="#section1")),
24
- Li(A("Background", href="#section2")),
25
- Li(A("Main Content", href="#section3")),
26
- Li(A("Conclusion", href="#section4")),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  ),
28
- cls="toc",
29
  ),
30
- Main(
31
- H1("Simple Blog Post"),
32
  Section(
33
  H2("Introduction"),
34
  P("""We are excited to introduce TxT360, a
@@ -166,7 +181,6 @@ def get():
166
  """),
167
  id="section4",
168
  ),
169
- cls="content",
170
  ),
171
  cls="container",
172
  ),
 
1
  from fasthtml_hf import setup_hf_backup
2
  from fasthtml.common import *
3
+ from fasthtml.components import *
4
+ from fasthtml.components import D_title, D_article, D_front_matter, D_contents, D_byline
5
 
6
 
7
  app, rt = fast_app()
 
13
  Head(
14
  Meta(charset="UTF-8"),
15
  Meta(name="viewport", content="width=device-width, initial-scale=1.0"),
 
16
  Link(rel="stylesheet", href="style.css"),
17
+ Script(src="https://distill.pub/template.v2.js"),
18
  ),
19
  Body(
20
+ D_title(
21
+ H1(
22
+ "TxT360: fully open and transparent fusion of web and curated corpora for pre-training large language models",
23
+ cls="l-page",
24
+ style="text-align: center;",
25
+ )
26
+ ),
27
+ D_article(
28
+ D_contents(
29
+ Nav(
30
+ H3("Table of Contents"),
31
+ Div(A("TxT360")),
32
+ Ul(
33
+ Li(A("Introduction", href="#section1")),
34
+ Li(A("Background", href="#section2")),
35
+ Li(A("Main Content", href="#section3")),
36
+ Li(A("Conclusion", href="#section4")),
37
+ ),
38
+ Div(A("Web Data", href="#section5")),
39
+ Div(A("Curated Sources", href="#section3")),
40
+ Div(A("Common Steps", href="#section4")),
41
+ Div(A("TxT360 Results", href="#section4")),
42
+ role="navigation",
43
+ cls="l-text figcaption",
44
  ),
 
45
  ),
46
+ Div(
 
47
  Section(
48
  H2("Introduction"),
49
  P("""We are excited to introduce TxT360, a
 
181
  """),
182
  id="section4",
183
  ),
 
184
  ),
185
  cls="container",
186
  ),
style.css CHANGED
@@ -1,65 +1,259 @@
1
- body {
2
- font-family: Arial, sans-serif;
3
- margin: 0;
4
- padding: 0;
 
 
 
 
 
 
 
 
5
  display: flex;
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
7
 
8
- .container {
9
  display: flex;
10
- width: 100%;
 
 
 
 
11
  }
12
 
13
- .toc {
14
- width: 20%;
15
- background-color: #f4f4f4;
16
- padding: 20px;
17
- box-shadow: 2px 0 5px rgba(0,0,0,0.1);
18
- position: fixed;
19
- height: 100%;
20
- overflow-y: auto;
21
  }
22
 
23
- .toc h2 {
24
- font-size: 1.5em;
25
- margin-bottom: 10px;
 
 
 
 
 
 
 
26
  }
27
 
28
- .toc ul {
29
- list-style-type: none;
30
- padding: 0;
 
 
 
31
  }
32
 
33
- .toc ul li {
34
- margin-bottom: 10px;
 
 
 
 
35
  }
36
 
37
- .toc ul li a {
38
- text-decoration: none;
39
- color: #333;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
- .toc ul li a:hover {
43
  text-decoration: underline;
44
  }
45
 
46
- .content {
47
- margin-left: 30%;
48
- margin-right: 10%;
49
- padding: 30px;
50
- width: 80%;
 
 
 
 
 
 
 
 
51
  }
52
 
53
- .content h1 {
54
- font-size: 2em;
55
- margin-bottom: 20px;
56
  }
57
 
58
- .content section {
59
- margin-bottom: 40px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  }
61
 
62
- .content section h2 {
63
- font-size: 1.5em;
64
- margin-bottom: 10px;
65
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* style.css */
2
+ /* Define colors */
3
+ :root {
4
+ --distill-gray: rgb(107, 114, 128);
5
+ --distill-gray-light: rgb(185, 185, 185);
6
+ --distill-gray-lighter: rgb(228, 228, 228);
7
+ --distill-gray-lightest: rgb(245, 245, 245);
8
+ --distill-blue: #007BFF;
9
+ }
10
+
11
+ /* Container for the controls */
12
+ [id^="plot-"] {
13
  display: flex;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ gap: 15px; /* Adjust the gap between controls as needed */
17
+ }
18
+ [id^="plot-"] figure {
19
+ margin-bottom: 0px;
20
+ margin-top: 0px;
21
+ padding: 0px;
22
+ }
23
+
24
+ .plotly_caption {
25
+ font-style: italic;
26
+ margin-top: 10px;
27
  }
28
 
29
+ .plotly_controls {
30
  display: flex;
31
+ flex-wrap: wrap;
32
+ flex-direction: row;
33
+ justify-content: center;
34
+ align-items: flex-start;
35
+ gap: 30px;
36
  }
37
 
38
+
39
+ .plotly_input_container {
40
+ display: flex;
41
+ align-items: center;
42
+ flex-direction: column;
43
+ gap: 10px;
 
 
44
  }
45
 
46
+ /* Style for the select dropdown */
47
+ .plotly_input_container > select {
48
+ padding: 2px 4px;
49
+ /* border: 1px solid #ccc; */
50
+ line-height: 1.5em;
51
+ text-align: center;
52
+ border-radius: 4px;
53
+ font-size: 12px;
54
+ background-color: var(--distill-gray-lightest);
55
+ outline: none;
56
  }
57
 
58
+ /* Style for the range input */
59
+
60
+ .plotly_slider {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: 10px;
64
  }
65
 
66
+ .plotly_slider > input[type="range"] {
67
+ -webkit-appearance: none;
68
+ height: 2px;
69
+ background: var(--distill-gray-light);
70
+ border-radius: 5px;
71
+ outline: none;
72
  }
73
 
74
+ .plotly_slider > span {
75
+ font-size: 14px;
76
+ line-height: 1.6em;
77
+ min-width: 16px;
78
+ }
79
+
80
+ .plotly_slider > input[type="range"]::-webkit-slider-thumb {
81
+ -webkit-appearance: none;
82
+ appearance: none;
83
+ width: 18px;
84
+ height: 18px;
85
+ border-radius: 50%;
86
+ background: var(--distill-blue);
87
+ cursor: pointer;
88
+ }
89
+
90
+ .plotly_slider > input[type="range"]::-moz-range-thumb {
91
+ width: 18px;
92
+ height: 18px;
93
+ border-radius: 50%;
94
+ background: var(--distill-blue);
95
+ cursor: pointer;
96
+ }
97
+
98
+ /* Style for the labels */
99
+ .plotly_input_container > label {
100
+ font-size: 14px;
101
+ font-weight: bold;
102
+ }
103
+
104
+ .main-plot-container {
105
+ margin-top: 21px;
106
+ margin-bottom: 35px;
107
+ }
108
+
109
+ .main-plot-container > figure {
110
+ display: block !important;
111
+ /* Let this be handled by graph-container */
112
+ margin-bottom: 0px;
113
+ margin-top: 0px;
114
+ }
115
+ .main-plot-container > div {
116
+ display: none !important;
117
+ }
118
+
119
+
120
+ @media (min-width: 768px) {
121
+ .main-plot-container > figure {
122
+ display: none !important;
123
+ }
124
+ .main-plot-container > div {
125
+ display: flex !important;
126
+ }
127
+ }
128
+
129
+ d-byline .byline {
130
+ grid-template-columns: 1fr;
131
+ grid-column: text;
132
+ font-size: 0.9rem;
133
+ line-height: 1.8em;
134
+ }
135
+
136
+ @media (min-width: 768px) {
137
+ d-byline .byline {
138
+ grid-template-columns: 5fr 1fr 1fr;
139
+ }
140
+ }
141
+
142
+ #title-plot {
143
+ margin-top: 0px;
144
+ margin-bottom: 0px;
145
  }
146
 
147
+ d-contents > nav a.active {
148
  text-decoration: underline;
149
  }
150
 
151
+ @media (max-width: 1199px) {
152
+ d-contents {
153
+ display: none;
154
+ justify-self: start;
155
+ align-self: start;
156
+ padding-bottom: 0.5em;
157
+ margin-bottom: 1em;
158
+ padding-left: 0.25em;
159
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
160
+ border-bottom-width: 1px;
161
+ border-bottom-style: solid;
162
+ border-bottom-color: rgba(0, 0, 0, 0.1);
163
+ }
164
  }
165
 
166
+ d-contents a:hover {
167
+ border-bottom: none;
 
168
  }
169
 
170
+
171
+ @media (min-width: 1200px) {
172
+ d-article {
173
+ /* Ensure d-article does not prevent sticky positioning */
174
+ overflow: visible;
175
+ }
176
+
177
+ d-contents {
178
+ align-self: start;
179
+ grid-column-start: 1 !important;
180
+ grid-column-end: 4 !important;
181
+ grid-row: auto / span 6;
182
+ justify-self: end;
183
+ margin-top: 0em;
184
+ padding-right: 3em;
185
+ padding-left: 2em;
186
+ border-right: 1px solid rgba(0, 0, 0, 0.1);
187
+ border-right-width: 1px;
188
+ border-right-style: solid;
189
+ border-right-color: rgba(0, 0, 0, 0.1);
190
+ position: -webkit-sticky; /* For Safari */
191
+ position: sticky;
192
+ top: 10px; /* Adjust this value if needed */
193
+ }
194
+ }
195
+
196
+ d-contents nav h3 {
197
+ margin-top: 0;
198
+ margin-bottom: 1em;
199
+ }
200
+
201
+ d-contents nav div {
202
+ color: rgba(0, 0, 0, 0.8);
203
+ font-weight: bold;
204
+ }
205
+
206
+ d-contents nav a {
207
+ color: rgba(0, 0, 0, 0.8);
208
+ border-bottom: none;
209
+ text-decoration: none;
210
+ }
211
+
212
+ d-contents li {
213
+ list-style-type: none;
214
+ }
215
+
216
+ d-contents ul, d-article d-contents ul {
217
+ padding-left: 1em;
218
+ }
219
+
220
+ d-contents nav ul li {
221
+ margin-bottom: .25em;
222
  }
223
 
224
+ d-contents nav a:hover {
225
+ text-decoration: underline solid rgba(0, 0, 0, 0.6);
 
226
  }
227
+
228
+ d-contents nav ul {
229
+ margin-top: 0;
230
+ margin-bottom: 6px;
231
+ }
232
+
233
+
234
+ d-contents nav > div {
235
+ display: block;
236
+ outline: none;
237
+ margin-bottom: 0.5em;
238
+ }
239
+
240
+ d-contents nav > div > a {
241
+ font-size: 13px;
242
+ font-weight: 600;
243
+ }
244
+
245
+ d-article aside {
246
+ margin-bottom: 1em;
247
+ }
248
+
249
+ @media (min-width: 768px) {
250
+ d-article aside {
251
+ margin-bottom: 0;
252
+ }
253
+ }
254
+
255
+ d-contents nav > div > a:hover,
256
+ d-contents nav > ul > li > a:hover {
257
+ text-decoration: none;
258
+ }
259
+