EveSa commited on
Commit
85ae3b4
2 Parent(s): 048ca46 93c6a71

Merge remote-tracking branch 'origin/main'

Browse files
Files changed (2) hide show
  1. src/inference_t5.py +2 -0
  2. templates/index.html.jinja +1 -474
src/inference_t5.py CHANGED
@@ -3,6 +3,8 @@
3
  """
4
  import re
5
  import string
 
 
6
 
7
  import contractions
8
  import torch
 
3
  """
4
  import re
5
  import string
6
+ import os
7
+ os.environ['TRANSFORMERS_CACHE'] = './.cache'
8
 
9
  import contractions
10
  import torch
templates/index.html.jinja CHANGED
@@ -4,480 +4,7 @@
4
  <title>Text summarization API</title>
5
  <meta charset="utf-8" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
7
- <style>
8
- html, body, div, h1, h2, p, blockquote,
9
- a, code, em, img, strong, u, ul, li,
10
- label, legend, caption, tr, th, td,
11
- header, menu, nav, section, summary {
12
- margin: 0;
13
- padding: 0;
14
- border: 0;
15
- font-size: 100%;
16
- font: inherit;
17
- vertical-align: baseline;}
18
-
19
- header, menu, nav, section {
20
- display: block;}
21
-
22
- div {
23
- margin-bottom: 20px;
24
- }
25
-
26
- body {
27
- line-height: 1;
28
- }
29
-
30
- ul {
31
- list-style: none;
32
- }
33
-
34
- body {
35
- -webkit-text-size-adjust: none;
36
- }
37
-
38
- input::-moz-focus-inner {
39
- border: 0;
40
- padding: 0;
41
- }
42
-
43
-
44
- /* Basic */
45
-
46
- html {
47
- box-sizing: border-box;
48
- }
49
-
50
- *, *:before, *:after {
51
- box-sizing: inherit;
52
- }
53
-
54
- body {
55
- color: #5b5b5b;
56
- font-size: 15pt;
57
- line-height: 1.85em;
58
- font-family: 'Source Sans Pro', sans-serif;
59
- font-weight: 300;
60
- background-image: url("site_style/images/background.jpg");
61
- background-size: cover;
62
- background-position: center center;
63
- background-attachment: fixed;
64
- }
65
-
66
- h1, h2, h3 {
67
- font-weight: 400;
68
- color: #483949;
69
- line-height: 1.25em;
70
- }
71
-
72
- h1 a, h2 a, h3 a {
73
- color: inherit;
74
- text-decoration: none;
75
- border-bottom-color: transparent;
76
- }
77
-
78
- h1 strong, h2 strong, h3 strong {
79
- font-weight: 600;
80
- }
81
-
82
- h2 {
83
- font-size: 2.85em;
84
- }
85
-
86
- h3 {
87
- font-size: 1.25em;
88
- }
89
-
90
- strong, b {
91
- font-weight: 400;
92
- color: #483949;
93
- }
94
-
95
- em, i {
96
- font-style: italic;
97
- }
98
-
99
- a {
100
- color: inherit;
101
- border-bottom: solid 1px rgba(128, 128, 128, 0.15);
102
- text-decoration: none;
103
- -moz-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
104
- -webkit-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
105
- -ms-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
106
- transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
107
- }
108
-
109
- a:hover {
110
- color: #ef8376;
111
- border-bottom-color: transparent;
112
- }
113
-
114
- p, ul {
115
- margin-bottom: 1em;
116
- }
117
-
118
- p {
119
- text-align: justify;
120
- }
121
-
122
- hr {
123
- position: relative;
124
- display: block;
125
- border: 0;
126
- top: 4.5em;
127
- margin-bottom: 9em;
128
- height: 6px;
129
- border-top: solid 1px rgba(128, 128, 128, 0.2);
130
- border-bottom: solid 1px rgba(128, 128, 128, 0.2);
131
- }
132
-
133
- hr:before, hr:after {
134
- content: '';
135
- position: absolute;
136
- top: -8px;
137
- display: block;
138
- width: 1px;
139
- height: 21px;
140
- background: rgba(128, 128, 128, 0.2);
141
- }
142
-
143
- hr:before {
144
- left: -1px;
145
- }
146
-
147
- hr:after {
148
- right: -1px;
149
- }
150
-
151
- /* List */
152
-
153
- ul {
154
- list-style: disc;
155
- padding-left: 1em;
156
- }
157
-
158
- ul li {
159
- padding-left: 0.5em;
160
- font-size: 85%;
161
- list-style: none;
162
- }
163
-
164
- /* Form */
165
- textarea {
166
- border-radius: 10px;
167
- resize: none;
168
- padding: 10px;
169
- line-height: 20px;
170
- word-spacing: 1px;
171
- font-size: 16px;
172
- width: 85%;
173
- height: 100%;
174
- }
175
-
176
- /* WebKit, Edge */
177
- ::-webkit-input-placeholder {
178
- font-size: 17px;
179
- word-spacing: 1px;
180
- }
181
-
182
- /* Table */
183
-
184
- table {
185
- width: 100%;
186
- }
187
-
188
- table.default {
189
- width: 100%;
190
- }
191
-
192
- table.default tbody tr:first-child {
193
- border-top: 0;
194
- }
195
-
196
- table.default tbody tr:nth-child(2n+1) {
197
- background: #fafafa;
198
- }
199
-
200
- table.default th {
201
- text-align: left;
202
- font-weight: 400;
203
- padding: 0.5em 1em 0.5em 1em;
204
- }
205
-
206
- /* Button */
207
-
208
- input[type="button"],
209
- input[type="submit"],
210
- input[type="reset"],
211
- button,
212
- .button {
213
- position: relative;
214
- display: inline-block;
215
- background: #df7366;
216
- color: #fff;
217
- text-align: center;
218
- border-radius: 0.5em;
219
- text-decoration: none;
220
- padding: 0.65em 3em 0.65em 3em;
221
- border: 0;
222
- cursor: pointer;
223
- outline: 0;
224
- font-weight: 300;
225
- -moz-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
226
- -webkit-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
227
- -ms-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
228
- transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;
229
- }
230
-
231
- input[type="button"]:hover,
232
- input[type="submit"]:hover,
233
- input[type="reset"]:hover,
234
- button:hover,
235
- .button:hover {
236
- color: #fff;
237
- background: #ef8376;
238
- }
239
-
240
- input[type="button"].alt,
241
- input[type="submit"].alt,
242
- input[type="reset"].alt,
243
- button.alt,
244
- .button.alt {
245
- background: #2B252C;
246
- }
247
-
248
- input[type="button"].alt:hover,
249
- input[type="submit"].alt:hover,
250
- input[type="reset"].alt:hover,
251
- button.alt:hover,
252
- .button.alt:hover {
253
- background: #3B353C;
254
- }
255
-
256
- /* Header */
257
-
258
- #header {
259
- position: relative;
260
- background-size: cover;
261
- background-position: center center;
262
- background-attachment: fixed;
263
- color: #fff;
264
- text-align: center;
265
- padding: 5em 0 2em 0;
266
- cursor: default;
267
- height: 100%;
268
- }
269
-
270
- #header:before {
271
- content: '';
272
- display: inline-block;
273
- vertical-align: middle;
274
- height: 100%;
275
- }
276
-
277
- #header .inner {
278
- position: relative;
279
- z-index: 1;
280
- margin: 0;
281
- display: inline-block;
282
- vertical-align: middle;
283
- }
284
-
285
- #header header {
286
- display: inline-block;
287
- }
288
-
289
- #header header > p {
290
- font-size: 1.25em;
291
- margin: 0;
292
- }
293
-
294
- #header h1 {
295
- color: #fff;
296
- font-size: 3em;
297
- line-height: 1em;
298
- }
299
-
300
- #header h1 a {
301
- color: inherit;
302
- }
303
-
304
- #header .button {
305
- display: inline-block;
306
- border-radius: 100%;
307
- width: 4.5em;
308
- height: 4.5em;
309
- line-height: 4.5em;
310
- text-align: center;
311
- font-size: 1.25em;
312
- padding: 0;
313
- }
314
-
315
- #header hr {
316
- top: 1.5em;
317
- margin-bottom: 3em;
318
- border-bottom-color: rgba(192, 192, 192, 0.35);
319
- box-shadow: inset 0 1px 0 0 rgba(192, 192, 192, 0.35);
320
- }
321
-
322
- #header hr:before, #header hr:after {
323
- background: rgba(192, 192, 192, 0.35);
324
- }
325
-
326
- /* Nav */
327
-
328
- #nav {
329
- position: absolute;
330
- top: 0;
331
- left: 0;
332
- width: 100%;
333
- text-align: center;
334
- padding: 1.5em 0 1.5em 0;
335
- z-index: 1;
336
- overflow: hidden;
337
- }
338
-
339
- #nav > hr {
340
- top: 0.5em;
341
- margin-bottom: 6em;
342
- }
343
-
344
- /* Footer */
345
-
346
- .copyright{
347
- margin-top: 50px;
348
- }
349
-
350
- /* Wide */
351
-
352
- @media screen and (max-width: 1680px) {
353
-
354
- /* Basic */
355
-
356
- body, input, select {
357
- font-size: 14pt;
358
- line-height: 1.75em;
359
- }
360
- }
361
-
362
- /* Normal */
363
-
364
- @media screen and (max-width: 1280px) {
365
-
366
- /* Basic */
367
-
368
- body, input, select {
369
- font-size: 12pt;
370
- line-height: 1.5em;
371
- }
372
-
373
- /* Header */
374
-
375
- #header {
376
- background-attachment: scroll;
377
- }
378
-
379
- #header .inner {
380
- padding-left: 2em;
381
- padding-right: 2em;
382
- }
383
- }
384
-
385
- /* Narrow */
386
-
387
- /* Narrower */
388
-
389
- @media screen and (max-width: 840px) {
390
-
391
- /* Basic */
392
-
393
- body, input, select {
394
- font-size: 13pt;
395
- line-height: 1.65em;
396
- }
397
- }
398
-
399
- /* Mobile */
400
-
401
- #navPanel, #titleBar {
402
- display: none;
403
- }
404
-
405
- @media screen and (max-width: 736px) {
406
-
407
- /* Basic */
408
-
409
- html, body {
410
- overflow-x: hidden;
411
- }
412
-
413
- body, input, select {
414
- font-size: 12.5pt;
415
- line-height: 1.5em;
416
- }
417
-
418
- h2 {
419
- font-size: 1.75em;
420
- }
421
-
422
- h3 {
423
- font-size: 1.25em;
424
- }
425
-
426
- hr {
427
- top: 3em;
428
- margin-bottom: 6em;
429
- }
430
-
431
- #header {
432
- background-attachment: scroll;
433
- padding: 2.5em 0 0 0;
434
- }
435
-
436
- #header .inner {
437
- padding-top: 1.5em;
438
- padding-left: 1em;
439
- padding-right: 1em;
440
- }
441
-
442
- #header header > p {
443
- font-size: 1em;
444
- }
445
-
446
- #header h1 {
447
- font-size: 1.75em;
448
- }
449
-
450
- #header hr {
451
- top: 1em;
452
- margin-bottom: 2.5em;
453
- }
454
-
455
- #nav {
456
- display: none;
457
- }
458
-
459
- #main > header {
460
- text-align: center;
461
- }
462
-
463
- div.copyright {
464
- margin-top: 10px;
465
- }
466
-
467
- label, textarea {
468
- font-size: 0.8rem;
469
- letter-spacing: 1px;
470
- font-family: Georgia, 'Times New Roman', Times, serif;
471
- }
472
-
473
- .buttons {
474
- display: flex;
475
- flex-direction: row;
476
- justify-content: center;
477
- margin-top: 20px;
478
- }
479
- }
480
-
481
  </style>
482
  <script>
483
  function customReset()
 
4
  <title>Text summarization API</title>
5
  <meta charset="utf-8" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
7
+ <style>html, body, div, h1, h2, p, blockquote,a, code, em, img, strong, u, ul, li,label, legend, caption, tr, th, td,header, menu, nav, section, summary{margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline}header, menu, nav, section{display: block}div{margin-bottom: 20px}body{line-height: 1}ul{list-style: none}body{-webkit-text-size-adjust: none}input::-moz-focus-inner{border: 0;padding: 0}html{box-sizing: border-box}*, *:before, *:after{box-sizing: inherit}body{color: #5b5b5b;font-size: 15pt;line-height: 1.85em;font-family: 'Source Sans Pro', sans-serif;font-weight: 300;background-image: url("templates/site_style/images/background.jpg");background-size: cover;background-position: center center;background-attachment: fixed}h1, h2, h3{font-weight: 400;color: #483949;line-height: 1.25em}h1 a, h2 a, h3 a{color: inherit;text-decoration: none;border-bottom-color: transparent}h1 strong, h2 strong, h3 strong{font-weight: 600}h2{font-size: 2.85em}h3{font-size: 1.25em}strong, b{font-weight: 400;color: #483949}em, i{font-style: italic}a{color: inherit;border-bottom: solid 1px rgba(128, 128, 128, 0.15);text-decoration: none;-moz-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;-webkit-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;-ms-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out}a:hover{color: #ef8376;border-bottom-color: transparent}p, ul{margin-bottom: 1em}p{text-align: justify}hr{position: relative;display: block;border: 0;top: 4.5em;margin-bottom: 9em;height: 6px;border-top: solid 1px rgba(128, 128, 128, 0.2);border-bottom: solid 1px rgba(128, 128, 128, 0.2)}hr:before, hr:after{content: '';position: absolute;top: -8px;display: block;width: 1px;height: 21px;background: rgba(128, 128, 128, 0.2)}hr:before{left: -1px}hr:after{right: -1px}ul{list-style: disc;padding-left: 1em}ul li{padding-left: 0.5em;font-size: 85%;list-style: none}textarea{border-radius: 10px;resize: none;padding: 10px;line-height: 20px;word-spacing: 1px;font-size: 16px;width: 85%;height: 100%}::-webkit-input-placeholder{font-size: 17px;word-spacing: 1px}table{width: 100%}table.default{width: 100%}table.default tbody tr:first-child{border-top: 0}table.default tbody tr:nth-child(2n 1){background: #fafafa}table.default th{text-align: left;font-weight: 400;padding: 0.5em 1em 0.5em 1em}input[type="button"],input[type="submit"],input[type="reset"],button,.button{position: relative;display: inline-block;background: #df7366;color: #fff;text-align: center;border-radius: 0.5em;text-decoration: none;padding: 0.65em 3em 0.65em 3em;border: 0;cursor: pointer;outline: 0;font-weight: 300;-moz-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;-webkit-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;-ms-transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out;transition: background-color 0.35s ease-in-out, color 0.35s ease-in-out, border-bottom-color 0.35s ease-in-out}input[type="button"]:hover,input[type="submit"]:hover,input[type="reset"]:hover,button:hover,.button:hover{color: #fff;background: #ef8376}input[type="button"].alt,input[type="submit"].alt,input[type="reset"].alt,button.alt,.button.alt{background: #2B252C}input[type="button"].alt:hover,input[type="submit"].alt:hover,input[type="reset"].alt:hover,button.alt:hover,.button.alt:hover{background: #3B353C}#header{position: relative;background-size: cover;background-position: center center;background-attachment: fixed;color: #fff;text-align: center;padding: 5em 0 2em 0;cursor: default;height: 100%}#header:before{content: '';display: inline-block;vertical-align: middle;height: 100%}#header .inner{position: relative;z-index: 1;margin: 0;display: inline-block;vertical-align: middle}#header header{display: inline-block}#header header > p{font-size: 1.25em;margin: 0}#header h1{color: #fff;font-size: 3em;line-height: 1em}#header h1 a{color: inherit}#header .button{display: inline-block;border-radius: 100%;width: 4.5em;height: 4.5em;line-height: 4.5em;text-align: center;font-size: 1.25em;padding: 0}#header hr{top: 1.5em;margin-bottom: 3em;border-bottom-color: rgba(192, 192, 192, 0.35);box-shadow: inset 0 1px 0 0 rgba(192, 192, 192, 0.35)}#header hr:before, #header hr:after{background: rgba(192, 192, 192, 0.35)}#nav{position: absolute;top: 0;left: 0;width: 100%;text-align: center;padding: 1.5em 0 1.5em 0;z-index: 1;overflow: hidden}#nav > hr{top: 0.5em;margin-bottom: 6em}.copyright{margin-top: 50px}@media screen and (max-width: 1680px){body, input, select{font-size: 14pt;line-height: 1.75em}}@media screen and (max-width: 1280px){body, input, select{font-size: 12pt;line-height: 1.5em}#header{background-attachment: scroll}#header .inner{padding-left: 2em;padding-right: 2em}}@media screen and (max-width: 840px){body, input, select{font-size: 13pt;line-height: 1.65em}}#navPanel, #titleBar{display: none}@media screen and (max-width: 736px){html, body{overflow-x: hidden}body, input, select{font-size: 12.5pt;line-height: 1.5em}h2{font-size: 1.75em}h3{font-size: 1.25em}hr{top: 3em;margin-bottom: 6em}#header{background-attachment: scroll;padding: 2.5em 0 0 0}#header .inner{padding-top: 1.5em;padding-left: 1em;padding-right: 1em}#header header > p{font-size: 1em}#header h1{font-size: 1.75em}#header hr{top: 1em;margin-bottom: 2.5em}#nav{display: none}#main > header{text-align: center}div.copyright{margin-top: 10px}label, textarea{font-size: 0.8rem;letter-spacing: 1px;font-family: Georgia, 'Times New Roman', Times, serif}.buttons{display: flex;flex-direction: row;justify-content: center;margin-top: 20px}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </style>
9
  <script>
10
  function customReset()