skytnt commited on
Commit
39b4f69
·
1 Parent(s): 2dae96c
.gitattributes CHANGED
@@ -25,3 +25,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ datgz filter=lfs diff=lfs merge=lfs -text
29
+ eot filter=lfs diff=lfs merge=lfs -text
30
+ ttf filter=lfs diff=lfs merge=lfs -text
31
+ *.ttf filter=lfs diff=lfs merge=lfs -text
32
+ *.datgz filter=lfs diff=lfs merge=lfs -text
33
+ *.eot filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+ MANIFEST
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .nox/
42
+ .coverage
43
+ .coverage.*
44
+ .cache
45
+ nosetests.xml
46
+ coverage.xml
47
+ *.cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+
51
+ # Translations
52
+ *.mo
53
+ *.pot
54
+
55
+ # Django stuff:
56
+ *.log
57
+ local_settings.py
58
+ db.sqlite3
59
+
60
+ # Flask stuff:
61
+ instance/
62
+ .webassets-cache
63
+
64
+ # Scrapy stuff:
65
+ .scrapy
66
+
67
+ # Sphinx documentation
68
+ docs/_build/
69
+
70
+ # PyBuilder
71
+ target/
72
+
73
+ # Jupyter Notebook
74
+ .ipynb_checkpoints
75
+
76
+ # IPython
77
+ profile_default/
78
+ ipython_config.py
79
+
80
+ # pyenv
81
+ .python-version
82
+
83
+ # celery beat schedule file
84
+ celerybeat-schedule
85
+
86
+ # SageMath parsed files
87
+ *.sage.py
88
+
89
+ # Environments
90
+ .env
91
+ .venv
92
+ env/
93
+ venv/
94
+ ENV/
95
+ env.bak/
96
+ venv.bak/
97
+
98
+ # Spyder project settings
99
+ .spyderproject
100
+ .spyproject
101
+
102
+ # Rope project settings
103
+ .ropeproject
104
+
105
+ # mkdocs documentation
106
+ /site
107
+
108
+ # mypy
109
+ .mypy_cache/
110
+ .dmypy.json
111
+ dmypy.json
112
+
113
+ # Pyre type checker
114
+ .pyre/
115
+
116
+ .idea/
app.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import T5Tokenizer, GPT2LMHeadModel
3
+ from flask import Flask, request, jsonify
4
+
5
+ device = torch.device("cpu")
6
+ if torch.cuda.is_available():
7
+ device = torch.device("cuda")
8
+
9
+ tokenizer = T5Tokenizer.from_pretrained("skytnt/gpt2-japanese-lyric-medium")
10
+ model = GPT2LMHeadModel.from_pretrained("skytnt/gpt2-japanese-lyric-medium")
11
+ model = model.to(device)
12
+
13
+
14
+ def gen_lyric(title: str, prompt_text: str):
15
+ if len(title) != 0 or len(prompt_text) != 0:
16
+ prompt_text = "<s>" + title + "[CLS]" + prompt_text
17
+ prompt_text = prompt_text.replace("\n", "\\n ")
18
+ prompt_tokens = tokenizer.tokenize(prompt_text)
19
+ prompt_token_ids = tokenizer.convert_tokens_to_ids(prompt_tokens)
20
+ prompt_tensor = torch.LongTensor(prompt_token_ids)
21
+ prompt_tensor = prompt_tensor.view(1, -1).to(device)
22
+ else:
23
+ prompt_tensor = None
24
+ # model forward
25
+ output_sequences = model.generate(
26
+ input_ids=prompt_tensor,
27
+ max_length=512,
28
+ top_p=0.95,
29
+ top_k=40,
30
+ temperature=1.0,
31
+ do_sample=True,
32
+ early_stopping=True,
33
+ bos_token_id=tokenizer.bos_token_id,
34
+ eos_token_id=tokenizer.eos_token_id,
35
+ pad_token_id=tokenizer.pad_token_id,
36
+ num_return_sequences=1
37
+ )
38
+
39
+ # convert model outputs to readable sentence
40
+ generated_sequence = output_sequences.tolist()[0]
41
+ generated_tokens = tokenizer.convert_ids_to_tokens(generated_sequence)
42
+ generated_text = tokenizer.convert_tokens_to_string(generated_tokens)
43
+ generated_text = "\n".join([s.strip() for s in generated_text.split('\\n')]).replace(' ', '\u3000').replace('<s>', '').replace('</s>', '\n\n---end---')
44
+ title_and_lyric = generated_text.split("[CLS]", 1)
45
+ if len(title_and_lyric) == 1:
46
+ title, lyric = "", title_and_lyric[0].strip()
47
+ else:
48
+ title, lyric = title_and_lyric[0].strip(), title_and_lyric[1].strip()
49
+ return title, lyric
50
+
51
+
52
+ app = Flask(__name__, static_url_path="", static_folder="static")
53
+
54
+
55
+ @app.route('/')
56
+ def index_page():
57
+ return app.send_static_file("index.html")
58
+
59
+
60
+ @app.route('/gen', methods=["POST"])
61
+ def generate():
62
+ if request.method == "POST":
63
+ try:
64
+ data = request.get_json()
65
+ title = data['title']
66
+ text = data['text']
67
+ title, lyric = gen_lyric(title, text)
68
+ result = {
69
+ "state": 200,
70
+ "title": title,
71
+ "lyric": lyric
72
+ }
73
+ except Exception as e:
74
+ result = {
75
+ "state": 400,
76
+ "msg": f"{e}"
77
+ }
78
+ return jsonify(result), result["state"]
79
+
80
+
81
+ if __name__ == '__main__':
82
+ app.run(host="0.0.0.0", port=7860, debug=False, use_reloader=False)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ flask
2
+ torch
3
+ transformers
4
+ sentencepiece
static/css/chunk-vendors.67710748.css ADDED
The diff for this file is too large to render. See raw diff
 
static/dict/base.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0803327762e1c93ca731e4319ab8343340f2806bb84941207782cde9d2d5a8eb
3
+ size 3956825
static/dict/cc.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02b7631be0d4de3a1a75cd9f9cc51536e4f94c9e6b389b813e06ba0f6e7de765
3
+ size 1692067
static/dict/check.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:193ae0035fff6fe812b58d9ee730e7a7d7ee601d918481ce51075c58114f6cc9
3
+ size 3111633
static/dict/tid.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d43d831cb6fb0f0a411739cd287a6d5e998e121a8daca614df14a81a0dcac586
3
+ size 1605820
static/dict/tid_map.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33efd5ffd87a70f669add093fa39dee44341d58f940844ef107c8fd98bb795b2
3
+ size 1485576
static/dict/tid_pos.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60dbfc99a6ab993f30c5dab648bec6ad7f9aaefa5c14e1843837d95e509f8895
3
+ size 5916009
static/dict/unk.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7f991cdeb9bfd3e9c0e4577cc50ee0815a11c508cccd444a9d3ab3c81521100
3
+ size 10512
static/dict/unk_char.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a8e86fd9aff32d323fbb59f5a7006f05927a11f8173c90712cc56293aeb3225
3
+ size 306
static/dict/unk_compat.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50f60aa29bc2e86c2903ab8c825bb6fa604d2b294d96941c1d3924259791899d
3
+ size 338
static/dict/unk_invoke.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b210889548457c3006913afd12c8b525562255f2709e404604be9614a25e94c
3
+ size 1140
static/dict/unk_map.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6df12460e5477230bb6fd9641def918b699fc0a8868016b6c9f794488630509b
3
+ size 1190
static/dict/unk_pos.datgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b183a29f281acc7e0542beca47b83f7985047c0a2d27e78a66f32276be5ad11
3
+ size 10540
static/favicon.ico ADDED
static/font/materialdesignicons-webfont.eot ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55c35c20bedf831352d92854c2c41863b5736eecb1bcec91c965713388d0c14b
3
+ size 1187136
static/font/materialdesignicons-webfont.ttf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e9b23f9dacd79641485a9a3e9d07035b8b22f13e8a15b25544ca9debf618f0f
3
+ size 1186916
static/font/materialdesignicons-webfont.woff ADDED
Binary file (539 kB). View file
 
static/font/materialdesignicons-webfont.woff2 ADDED
Binary file (373 kB). View file
 
static/font/materialdesignicons-webfont_ie.eot ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:55c35c20bedf831352d92854c2c41863b5736eecb1bcec91c965713388d0c14b
3
+ size 1187136
static/font/materialdesignicons.min.css ADDED
The diff for this file is too large to render. See raw diff
 
static/font/roboto.css ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* cyrillic-ext */
2
+ @font-face {
3
+ font-family: 'Roboto';
4
+ font-style: normal;
5
+ font-weight: 100;
6
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxFIzIFKw.woff2) format('woff2');
7
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
8
+ }
9
+ /* cyrillic */
10
+ @font-face {
11
+ font-family: 'Roboto';
12
+ font-style: normal;
13
+ font-weight: 100;
14
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxMIzIFKw.woff2) format('woff2');
15
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
16
+ }
17
+ /* greek-ext */
18
+ @font-face {
19
+ font-family: 'Roboto';
20
+ font-style: normal;
21
+ font-weight: 100;
22
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxEIzIFKw.woff2) format('woff2');
23
+ unicode-range: U+1F00-1FFF;
24
+ }
25
+ /* greek */
26
+ @font-face {
27
+ font-family: 'Roboto';
28
+ font-style: normal;
29
+ font-weight: 100;
30
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxLIzIFKw.woff2) format('woff2');
31
+ unicode-range: U+0370-03FF;
32
+ }
33
+ /* vietnamese */
34
+ @font-face {
35
+ font-family: 'Roboto';
36
+ font-style: normal;
37
+ font-weight: 100;
38
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxHIzIFKw.woff2) format('woff2');
39
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
40
+ }
41
+ /* latin-ext */
42
+ @font-face {
43
+ font-family: 'Roboto';
44
+ font-style: normal;
45
+ font-weight: 100;
46
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxGIzIFKw.woff2) format('woff2');
47
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
48
+ }
49
+ /* latin */
50
+ @font-face {
51
+ font-family: 'Roboto';
52
+ font-style: normal;
53
+ font-weight: 100;
54
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOkCnqEu92Fr1MmgVxIIzI.woff2) format('woff2');
55
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
56
+ }
57
+ /* cyrillic-ext */
58
+ @font-face {
59
+ font-family: 'Roboto';
60
+ font-style: normal;
61
+ font-weight: 300;
62
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2) format('woff2');
63
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
64
+ }
65
+ /* cyrillic */
66
+ @font-face {
67
+ font-family: 'Roboto';
68
+ font-style: normal;
69
+ font-weight: 300;
70
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2) format('woff2');
71
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
72
+ }
73
+ /* greek-ext */
74
+ @font-face {
75
+ font-family: 'Roboto';
76
+ font-style: normal;
77
+ font-weight: 300;
78
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2) format('woff2');
79
+ unicode-range: U+1F00-1FFF;
80
+ }
81
+ /* greek */
82
+ @font-face {
83
+ font-family: 'Roboto';
84
+ font-style: normal;
85
+ font-weight: 300;
86
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2) format('woff2');
87
+ unicode-range: U+0370-03FF;
88
+ }
89
+ /* vietnamese */
90
+ @font-face {
91
+ font-family: 'Roboto';
92
+ font-style: normal;
93
+ font-weight: 300;
94
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2) format('woff2');
95
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
96
+ }
97
+ /* latin-ext */
98
+ @font-face {
99
+ font-family: 'Roboto';
100
+ font-style: normal;
101
+ font-weight: 300;
102
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2) format('woff2');
103
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
104
+ }
105
+ /* latin */
106
+ @font-face {
107
+ font-family: 'Roboto';
108
+ font-style: normal;
109
+ font-weight: 300;
110
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmSU5fBBc4.woff2) format('woff2');
111
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
112
+ }
113
+ /* cyrillic-ext */
114
+ @font-face {
115
+ font-family: 'Roboto';
116
+ font-style: normal;
117
+ font-weight: 400;
118
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu72xKOzY.woff2) format('woff2');
119
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
120
+ }
121
+ /* cyrillic */
122
+ @font-face {
123
+ font-family: 'Roboto';
124
+ font-style: normal;
125
+ font-weight: 400;
126
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu5mxKOzY.woff2) format('woff2');
127
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
128
+ }
129
+ /* greek-ext */
130
+ @font-face {
131
+ font-family: 'Roboto';
132
+ font-style: normal;
133
+ font-weight: 400;
134
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7mxKOzY.woff2) format('woff2');
135
+ unicode-range: U+1F00-1FFF;
136
+ }
137
+ /* greek */
138
+ @font-face {
139
+ font-family: 'Roboto';
140
+ font-style: normal;
141
+ font-weight: 400;
142
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4WxKOzY.woff2) format('woff2');
143
+ unicode-range: U+0370-03FF;
144
+ }
145
+ /* vietnamese */
146
+ @font-face {
147
+ font-family: 'Roboto';
148
+ font-style: normal;
149
+ font-weight: 400;
150
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7WxKOzY.woff2) format('woff2');
151
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
152
+ }
153
+ /* latin-ext */
154
+ @font-face {
155
+ font-family: 'Roboto';
156
+ font-style: normal;
157
+ font-weight: 400;
158
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu7GxKOzY.woff2) format('woff2');
159
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
160
+ }
161
+ /* latin */
162
+ @font-face {
163
+ font-family: 'Roboto';
164
+ font-style: normal;
165
+ font-weight: 400;
166
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
167
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
168
+ }
169
+ /* cyrillic-ext */
170
+ @font-face {
171
+ font-family: 'Roboto';
172
+ font-style: normal;
173
+ font-weight: 500;
174
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2) format('woff2');
175
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
176
+ }
177
+ /* cyrillic */
178
+ @font-face {
179
+ font-family: 'Roboto';
180
+ font-style: normal;
181
+ font-weight: 500;
182
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2) format('woff2');
183
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
184
+ }
185
+ /* greek-ext */
186
+ @font-face {
187
+ font-family: 'Roboto';
188
+ font-style: normal;
189
+ font-weight: 500;
190
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2) format('woff2');
191
+ unicode-range: U+1F00-1FFF;
192
+ }
193
+ /* greek */
194
+ @font-face {
195
+ font-family: 'Roboto';
196
+ font-style: normal;
197
+ font-weight: 500;
198
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2) format('woff2');
199
+ unicode-range: U+0370-03FF;
200
+ }
201
+ /* vietnamese */
202
+ @font-face {
203
+ font-family: 'Roboto';
204
+ font-style: normal;
205
+ font-weight: 500;
206
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2) format('woff2');
207
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
208
+ }
209
+ /* latin-ext */
210
+ @font-face {
211
+ font-family: 'Roboto';
212
+ font-style: normal;
213
+ font-weight: 500;
214
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2) format('woff2');
215
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
216
+ }
217
+ /* latin */
218
+ @font-face {
219
+ font-family: 'Roboto';
220
+ font-style: normal;
221
+ font-weight: 500;
222
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmEU9fBBc4.woff2) format('woff2');
223
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
224
+ }
225
+ /* cyrillic-ext */
226
+ @font-face {
227
+ font-family: 'Roboto';
228
+ font-style: normal;
229
+ font-weight: 700;
230
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2) format('woff2');
231
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
232
+ }
233
+ /* cyrillic */
234
+ @font-face {
235
+ font-family: 'Roboto';
236
+ font-style: normal;
237
+ font-weight: 700;
238
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2) format('woff2');
239
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
240
+ }
241
+ /* greek-ext */
242
+ @font-face {
243
+ font-family: 'Roboto';
244
+ font-style: normal;
245
+ font-weight: 700;
246
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2) format('woff2');
247
+ unicode-range: U+1F00-1FFF;
248
+ }
249
+ /* greek */
250
+ @font-face {
251
+ font-family: 'Roboto';
252
+ font-style: normal;
253
+ font-weight: 700;
254
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2) format('woff2');
255
+ unicode-range: U+0370-03FF;
256
+ }
257
+ /* vietnamese */
258
+ @font-face {
259
+ font-family: 'Roboto';
260
+ font-style: normal;
261
+ font-weight: 700;
262
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2) format('woff2');
263
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
264
+ }
265
+ /* latin-ext */
266
+ @font-face {
267
+ font-family: 'Roboto';
268
+ font-style: normal;
269
+ font-weight: 700;
270
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2) format('woff2');
271
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
272
+ }
273
+ /* latin */
274
+ @font-face {
275
+ font-family: 'Roboto';
276
+ font-style: normal;
277
+ font-weight: 700;
278
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.woff2) format('woff2');
279
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
280
+ }
281
+ /* cyrillic-ext */
282
+ @font-face {
283
+ font-family: 'Roboto';
284
+ font-style: normal;
285
+ font-weight: 900;
286
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfCRc4EsA.woff2) format('woff2');
287
+ unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
288
+ }
289
+ /* cyrillic */
290
+ @font-face {
291
+ font-family: 'Roboto';
292
+ font-style: normal;
293
+ font-weight: 900;
294
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfABc4EsA.woff2) format('woff2');
295
+ unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
296
+ }
297
+ /* greek-ext */
298
+ @font-face {
299
+ font-family: 'Roboto';
300
+ font-style: normal;
301
+ font-weight: 900;
302
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfCBc4EsA.woff2) format('woff2');
303
+ unicode-range: U+1F00-1FFF;
304
+ }
305
+ /* greek */
306
+ @font-face {
307
+ font-family: 'Roboto';
308
+ font-style: normal;
309
+ font-weight: 900;
310
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfBxc4EsA.woff2) format('woff2');
311
+ unicode-range: U+0370-03FF;
312
+ }
313
+ /* vietnamese */
314
+ @font-face {
315
+ font-family: 'Roboto';
316
+ font-style: normal;
317
+ font-weight: 900;
318
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfCxc4EsA.woff2) format('woff2');
319
+ unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
320
+ }
321
+ /* latin-ext */
322
+ @font-face {
323
+ font-family: 'Roboto';
324
+ font-style: normal;
325
+ font-weight: 900;
326
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfChc4EsA.woff2) format('woff2');
327
+ unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
328
+ }
329
+ /* latin */
330
+ @font-face {
331
+ font-family: 'Roboto';
332
+ font-style: normal;
333
+ font-weight: 900;
334
+ src: url(https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmYUtfBBc4.woff2) format('woff2');
335
+ unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
336
+ }
static/font/vuetify.min.css ADDED
The diff for this file is too large to render. See raw diff
 
static/index.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>日语歌词生成器</title><link rel="stylesheet" href="font/roboto.css"><link rel="stylesheet" href="font/materialdesignicons.min.css"><link href="/css/chunk-vendors.67710748.css" rel="preload" as="style"><link href="/js/app.33162291.js" rel="preload" as="script"><link href="/js/chunk-vendors.4a28e83e.js" rel="preload" as="script"><link href="/css/chunk-vendors.67710748.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but lyric-generator doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.4a28e83e.js"></script><script src="/js/app.33162291.js"></script></body></html>
static/js/app.33162291.js ADDED
@@ -0,0 +1 @@
 
 
1
+ (function(t){function e(e){for(var a,s,i=e[0],l=e[1],c=e[2],p=0,_=[];p<i.length;p++)s=i[p],Object.prototype.hasOwnProperty.call(n,s)&&n[s]&&_.push(n[s][0]),n[s]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(t[a]=l[a]);u&&u(e);while(_.length)_.shift()();return o.push.apply(o,c||[]),r()}function r(){for(var t,e=0;e<o.length;e++){for(var r=o[e],a=!0,i=1;i<r.length;i++){var l=r[i];0!==n[l]&&(a=!1)}a&&(o.splice(e--,1),t=s(s.s=r[0]))}return t}var a={},n={app:0},o=[];function s(e){if(a[e])return a[e].exports;var r=a[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.m=t,s.c=a,s.d=function(t,e,r){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},s.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)s.d(r,a,function(e){return t[e]}.bind(null,a));return r},s.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="/";var i=window["webpackJsonp"]=window["webpackJsonp"]||[],l=i.push.bind(i);i.push=e,i=i.slice();for(var c=0;c<i.length;c++)e(i[c]);var u=l;o.push([0,"chunk-vendors"]),r()})({0:function(t,e,r){t.exports=r("56d7")},"56d7":function(t,e,r){"use strict";r.r(e);r("e260"),r("e6cf"),r("cca6"),r("a79d");var a=r("2b0e"),n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("v-app",[r("v-app-bar",{attrs:{app:"",dark:"",color:"primary"}},[r("v-toolbar-title",[t._v(t._s(t.i18n.title))]),r("v-spacer"),r("v-select",{staticStyle:{"max-width":"10rem"},attrs:{items:["English","Chinese"],"prepend-icon":"mdi-web","hide-details":""},on:{change:function(e){return t.set_locale(t.locale_name)}},model:{value:t.locale_name,callback:function(e){t.locale_name=e},expression:"locale_name"}}),r("v-btn",{attrs:{href:"https://github.com/SkyTNT/gpt2-japanese-lyric",icon:""}},[r("v-icon",[t._v("mdi-github")])],1),r("v-btn",{attrs:{href:"https://fab.moe",icon:""}},[r("v-icon",[t._v("mdi-home")])],1)],1),r("v-main",[t.loading_kuroshiro?r("v-container",{staticStyle:{height:"100%"},attrs:{fluid:""}},[r("div",{staticClass:"py-2 d-flex flex-column justify-center align-center",staticStyle:{height:"100%"}},[r("v-progress-circular",{attrs:{color:"blue",indeterminate:""}}),r("label",{staticClass:"py-4 text"},[t._v(t._s(t.i18n.loading))])],1)]):t._e(),t.loading_kuroshiro?t._e():r("v-row",{staticClass:"mx-3"},[r("div",{staticClass:"col-12 offset-0 col-sm-8 offset-sm-2 col-md-8 offset-md-2 col-lg-6 offset-lg-3 col-xl-6 offset-xl-3 mt-8"},[r("v-textarea",{attrs:{label:t.i18n.input_title_label,disabled:t.loading,rows:"1","prepend-icon":"mdi-comment",hint:t.i18n.input_title_hint,"no-resize":""},model:{value:t.prompt_title,callback:function(e){t.prompt_title=e},expression:"prompt_title"}}),r("v-textarea",{attrs:{label:t.i18n.input_text_label,disabled:t.loading,rows:"2","prepend-icon":"mdi-comment",hint:t.i18n.input_text_hint,"no-resize":""},model:{value:t.prompt_text,callback:function(e){t.prompt_text=e},expression:"prompt_text"}}),r("v-row",[r("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.show_romaji},on:{change:function(e){t.show_type=t.show_romaji?0:1}},model:{value:t.show_romaji,callback:function(e){t.show_romaji=e},expression:"show_romaji"}}),r("v-scroll-x-transition",[t.show_romaji?r("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.romaji_systems,hint:t.i18n.romaji_system},model:{value:t.romaji_system,callback:function(e){t.romaji_system=e},expression:"romaji_system"}}):t._e()],1)],1),r("v-row",{staticClass:"mt-n8"},[r("v-checkbox",{staticClass:"col-6",attrs:{disabled:t.loading,label:t.i18n.use_translate},on:{change:function(e){t.show_type=t.use_trans?1:0}},model:{value:t.use_trans,callback:function(e){t.use_trans=e},expression:"use_trans"}}),r("v-scroll-x-transition",[t.use_trans?r("v-select",{staticClass:"col-6",attrs:{disabled:t.loading,items:t.google_supported_languages,hint:t.i18n.target_lang},model:{value:t.trans_target_lang,callback:function(e){t.trans_target_lang=e},expression:"trans_target_lang"}}):t._e()],1)],1),r("v-btn",{staticClass:"mb-10",attrs:{color:"primary",elevation:"5",loading:t.loading,text:"",block:"",large:"",tile:""},on:{click:function(e){return t.do_gen(0)}}},[t._v(t._s(t.i18n.generate))]),r("v-expand-transition",[0!==t.lyric.length?r("v-simple-table",{staticClass:"py-5",attrs:{dense:""},scopedSlots:t._u([{key:"default",fn:function(){return[r("thead",[r("tr",[r("th",[t._v(t._s(t.i18n.lyric)),r("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric("s")}}},[r("v-icon",[t._v("mdi-content-copy")])],1)],1),r("v-scroll-x-transition",[t.use_trans||t.show_romaji?r("th",[t.show_romaji&&!t.use_trans?r("span",[t._v(t._s(t.i18n.romaji))]):t._e(),!t.show_romaji&&t.use_trans?r("span",[t._v(t._s(t.i18n.translation))]):t._e(),t.use_trans&&t.show_romaji?r("v-btn",{staticClass:"mr-n2",attrs:{elevation:"0",text:"",small:""},on:{click:function(e){t.show_type=0===t.show_type?1:0}}},[t.show_romaji?r("span",{class:{"grey--text":1===t.show_type}},[t._v(t._s(t.i18n.romaji_s))]):t._e(),t._v("/"),t.use_trans?r("span",{class:{"grey--text":0===t.show_type}},[t._v(t._s(t.i18n.translation_s))]):t._e()]):t._e(),r("v-btn",{staticClass:"ml-2",attrs:{elevation:"0",fab:"","x-small":""},on:{click:function(e){return t.copy_lyric(0===t.show_type?"r":"t")}}},[r("v-icon",[t._v("mdi-content-copy")])],1)],1):t._e()])],1)]),r("tbody",{staticStyle:{"word-break":"break-word","word-wrap":"break-word"}},t._l(t.lyric,(function(e,a){return r("tr",{key:a,on:{mouseenter:function(e){t.hover=a},mouseleave:function(e){t.hover=-1}}},[r("td",{class:{"text-h6":0===a,"text-center":!e.is_lyric}},[t._v(" "+t._s(e.s)+" "),t.tts_support?r("v-scroll-x-transition",[t.tts_loading||""===e.s||t.speaking!==a&&(-1!==t.speaking||t.hover!==a)?t._e():r("v-btn",{class:{"mr-n9":!0,"blue--text":t.speaking===a},attrs:{icon:"",small:""},on:{click:function(e){return t.ja_tts(a)}}},[r("v-icon",[t._v("mdi-volume-high")])],1)],1):t._e(),t.tts_support&&t.speaking===a&&t.tts_loading?r("v-progress-circular",{staticClass:"mr-n9",attrs:{indeterminate:"",size:"20",width:"2",color:"primary"}}):t._e()],1),r("v-scroll-x-transition",[t.use_trans||t.show_romaji?r("td",{class:{"text-center":!e.is_lyric}},[t._v(t._s(0===t.show_type?e.r:e.t))]):t._e()])],1)})),0)]},proxy:!0}],null,!1,3397400449)}):t._e()],1)],1)]),r("v-snackbar",{attrs:{dark:"",timeout:2e3},scopedSlots:t._u([{key:"action",fn:function(e){var a=e.attrs;return[r("v-btn",t._b({attrs:{color:"blue",text:""},on:{click:function(e){t.snackbar=!1}}},"v-btn",a,!1),[t._v(" Close ")])]}}]),model:{value:t.snackbar,callback:function(e){t.snackbar=e},expression:"snackbar"}},[t._v(" "+t._s(t.snackbar_msg)+" ")])],1),r("v-footer",[r("v-row",{staticClass:"ma-0"},[r("div",{staticClass:"text-center caption col-12 pa-0"},[t._v(t._s(t.i18n.footer))]),r("div",{staticClass:"text-center caption col-12 pa-0"},[t._v("© 2022 SkyTNT")])])],1)],1)},o=[],s=r("1da1"),i=(r("96cf"),r("498a"),r("ac1f"),r("5319"),r("00b4"),r("99af"),r("1276"),r("d3b7"),r("bc3a")),l=r.n(i),c=r("1539"),u=r("856a");function p(){return/(iPhone|iPad|iPod|iOS|Android|Windows Phone)/i.test(navigator.userAgent)}String.prototype.trim||(String.prototype.trim=function(){return this.triml().trimr()},String.prototype.triml=function(){return this.replace(/^[\s\n\t]+/g,"")},String.prototype.trimr=function(){return this.replace(/[\s\n\t]+$/g,"")});var _={name:"App",data:function(){return{locale_name:"English",i18n:{},use_trans:!1,google_supported_languages:["af","sq","am","ar","hy","az","eu","be","bn","bs","bg","my","ca","ca","ceb","co","cs","da","nl","nl","en","eo","et","fi","fr","fy","ka","de","gd","gd","ga","gl","el","gu","ht","ht","ha","haw","he","hi","hr","hu","ig","is","id","it","jw","ja","kn","kk","km","ky","ky","ko","ku","lo","la","lv","lt","lb","lb","mk","ml","mi","mr","ms","mg","mt","mn","ne","no","ny","ny","ny","or","pa","pa","fa","pl","pt","ps","ps","ro","ro","ro","ru","si","si","sk","sl","sm","sn","sd","so","st","es","es","sr","su","sw","sv","ta","te","tg","tl","th","tr","ug","ug","uk","ur","uz","vi","cy","xh","yi","yo","zu","zh-CN","zh-TW"],trans_target_lang:"zh-CN",show_romaji:!1,show_type:0,romaji_systems:["nippon","passport","hepburn"],romaji_system:"hepburn",prompt_title:"桜",prompt_text:"",loading_kuroshiro:!0,loading:!1,lyric:[],tts_cache:{},tts_loading:!1,tts_support:!1,speaking:-1,hover:-1,snackbar:!1,snackbar_msg:"",kuroshiro:new c["a"]}},mounted:function(){this.locale_name="zh-CN"===(navigator.language||navigator.userLanguage)?"Chinese":"English","English"===this.locale_name&&(this.trans_target_lang="en"),this.set_locale(this.locale_name),this.loads()},methods:{set_locale:function(t){var e="English"===t?"en":"zh",r={en:{title:"Japanese Lyric Generator",loading:"Loading",input_title_label:"Title (can be empty)",input_text_label:"Beginning (can be empty)",input_title_hint:"Generate lyric for a given title",input_text_hint:"The generator continues with this text",show_romaji:"Show romaji",romaji_system:"Romaji system",use_translate:"Translate",target_lang:"Target language",generate:"Generate!",lyric:"Lyric",romaji:"Romaji",romaji_s:"R",translation:"Translation",translation_s:"T",footer:"The generated content can be used as you like, please share this site if you like.",copy_successful:"Copy successful",error:"Error",error_network:"Network error",error_failed_load_kuromoji:"Failed to load romaji converter",error_failed_covert_romaji:"Failed to convert lyric to romaji",error_failed_translate:"Failed to translate lyric",error_copy:"Copy failed, browser does not support"},zh:{title:"日语歌词生成器",loading:"加载中",input_title_label:"歌词标题(可不填)",input_text_label:"歌词开头(可不填)",input_title_hint:"给定标题生成歌词",input_text_hint:"生成器���这段文本进行续写",show_romaji:"显示罗马音",romaji_system:"罗马音系统",use_translate:"是否进行翻译",target_lang:"目标语言",generate:"生成!",lyric:"歌词",romaji:"罗马音",romaji_s:"音",translation:"翻译",translation_s:"译",footer:"生成的内容可以随意使用,喜欢的话就请分享本网站",copy_successful:"复制成功",error:"错误",error_network:"网络错误",error_failed_load_kuromoji:"罗马音转换器加载失败",error_failed_covert_romaji:"转换罗马音错误",error_failed_translate:"翻译出错",error_copy:"复制失败,浏览器不支持"}};this.i18n=r[e]},loads:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.load_kuroshiro();case 2:if(p()){e.next=8;break}return e.t0=eval,e.next=6,l.a.get("https://l2d.fab.moe/js/autoload.js");case 6:e.t1=e.sent.data,(0,e.t0)(e.t1);case 8:case"end":return e.stop()}}),e)})))()},load_kuroshiro:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.kuroshiro.init(new u["a"]({dictPath:"/dict/"}));case 3:e.next=9;break;case 5:e.prev=5,e.t0=e["catch"](0),t.show_snackbar(t.i18n.error_failed_load_kuromoji+":"+e.t0.message),console.log(e.t0);case 9:t.loading_kuroshiro=!1,console.log("kuroshiro loaded");case 11:case"end":return e.stop()}}),e,null,[[0,5]])})))()},do_gen:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){var r,a,n,o,s,i,c,u,p,_,m;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=t.prompt_title.trim(),a=t.prompt_text.trim(),t.loading=!0,t.lyric=[],t.tts_cache={},e.prev=5,e.next=8,l.a.post("/gen",{title:r,text:a});case 8:for(i in n=e.sent,o="".concat(n.data.title,"\n\n").concat(n.data.lyric),s=o.split("\n"),s)c=s[i].trim().replace(/ /g," "),t.lyric.push({s:c,r:"",t:"",is_lyric:"---end---"!==c});return t.lyric[0].is_lyric=!1,e.prev=13,e.next=16,t.kuroshiro.convert(o,{to:"romaji",mode:"spaced",romajiSystem:t.romaji_system});case 16:for(p in u=e.sent,u=u.split("\n"),u)t.lyric[p].r=u[p];e.next=24;break;case 21:e.prev=21,e.t0=e["catch"](13),t.show_snackbar(t.i18n.error_failed_covert_romaji+":"+e.t0.message);case 24:if(!t.use_trans){e.next=29;break}return e.next=27,t.google_translate(o);case 27:if(_=e.sent,""!==_)for(m in _=_.split("\n"),_)t.lyric[m].t=_[m].trim().replace(/ /g," ");case 29:t.loading=!1,e.next=36;break;case 32:e.prev=32,e.t1=e["catch"](5),console.log(e.t1),"Network Error"===e.t1.message||void 0===e.t1.response?(t.show_snackbar(t.i18n.error_network),t.loading=!1):(t.show_snackbar(t.i18n.error+":"+e.t1.response.data.msg),t.loading=!1);case 36:case"end":return e.stop()}}),e,null,[[5,32],[13,21]])})))()},google_translate:function(t){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){var a,n,o,s,i;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return a={client:"gtx",dt:"t",sl:"ja",tl:e.trans_target_lang,q:t},r.prev=1,r.next=4,l.a.get("https://translate.googleapis.com/translate_a/single",{params:a});case 4:for(i in n=r.sent,o="",s=n.data[0],s)o+=s[i][0];return r.abrupt("return",o);case 11:r.prev=11,r.t0=r["catch"](1),e.show_snackbar(e.i18n.error_failed_translate+":"+r.t0.message);case 14:return r.abrupt("return","");case 15:case"end":return r.stop()}}),r,null,[[1,11]])})))()},ja_tts:function(t){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){var a,n,o,s,i,c;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(a=e.lyric[t].s,-1===e.speaking&&""!==a){r.next=3;break}return r.abrupt("return");case 3:if(e.speaking=t,r.prev=4,n=new AudioContext,o=n.createGain(),o.gain.value=2,void 0!==e.tts_cache[a]){r.next=20;break}return e.tts_loading=!0,r.next=12,l.a.post("https://voicevox-skytnt.cloud.okteto.net/audio_query",null,{params:{speaker:4,text:a}});case 12:return s=r.sent.data,r.next=15,l.a.post("https://voicevox-skytnt.cloud.okteto.net/synthesis",s,{params:{speaker:4},responseType:"arraybuffer"});case 15:return i=r.sent.data,e.tts_loading=!1,r.next=19,n.decodeAudioData(i);case 19:e.tts_cache[a]=r.sent;case 20:return c=n.createBufferSource(),c.buffer=e.tts_cache[a],c.loop=!1,c.connect(o),o.connect(n.destination),r.next=27,new Promise((function(t){c.onended=function(){t()},c.start(0)}));case 27:r.next=32;break;case 29:r.prev=29,r.t0=r["catch"](4),e.show_snackbar(e.i18n.error+":"+r.t0.message);case 32:e.speaking=-1,e.tts_loading=!1;case 34:case"end":return r.stop()}}),r,null,[[4,29]])})))()},copy_lyric:function(t){var e="";for(var r in this.lyric)e+=this.lyric[r][t]+"\n";e=e.trim(),this.copy(e)},copy:function(t){var e=this;return Object(s["a"])(regeneratorRuntime.mark((function r(){var a,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.clipboard.writeText(t);case 3:e.show_snackbar(e.i18n.copy_successful),r.next=18;break;case 6:r.prev=6,r.t0=r["catch"](0),a=document.createElement("textarea"),a.style.position="fixed",a.style.top="-10000px",a.style.zIndex="-999",document.body.appendChild(a),console.log("input",a),a.value=t,a.focus(),a.select();try{n=document.execCommand("copy"),n&&"unsuccessful"!==n?e.show_snackbar(e.i18n.copy_successful):e.show_snackbar(e.i18n.error_copy)}catch(o){e.show_snackbar(e.i18n.error_copy)}finally{document.body.removeChild(a)}case 18:case"end":return r.stop()}}),r,null,[[0,6]])})))()},show_snackbar:function(t){this.snackbar=!0,this.snackbar_msg=t}}},m=_,d=r("2877"),h=r("6544"),g=r.n(h),f=r("7496"),v=r("40dc"),b=r("8336"),y=r("ac7c"),k=r("a523"),x=r("0789"),w=r("553a"),j=r("132d"),C=r("f6c4"),S=r("490a"),T=r("0fd9"),O=r("b974"),V=r("1f4f"),R=r("2db4"),P=r("2fa4"),z=r("a844"),E=r("2a7f"),A=Object(d["a"])(m,n,o,!1,null,null,null),N=A.exports;g()(A,{VApp:f["a"],VAppBar:v["a"],VBtn:b["a"],VCheckbox:y["a"],VContainer:k["a"],VExpandTransition:x["a"],VFooter:w["a"],VIcon:j["a"],VMain:C["a"],VProgressCircular:S["a"],VRow:T["a"],VScrollXTransition:x["d"],VSelect:O["a"],VSimpleTable:V["a"],VSnackbar:R["a"],VSpacer:P["a"],VTextarea:z["a"],VToolbarTitle:E["a"]});var M=r("f309");a["a"].use(M["a"]);var B=new M["a"]({}),F=r("8c4f");a["a"].use(F["a"]);var G=[],L=new F["a"]({routes:G}),q=L;a["a"].config.productionTip=!1,new a["a"]({vuetify:B,router:q,render:function(t){return t(N)}}).$mount("#app")}});
static/js/chunk-vendors.4a28e83e.js ADDED
The diff for this file is too large to render. See raw diff