mkutarna commited on
Commit
3cc2a8f
1 Parent(s): 9bbd705

Replaced test_predict pt and txt files with smaller test files

Browse files

Former-commit-id: bdb885c97e6f3b0ecaae4767c000674966af7d14 [formerly 12af048790a5613b2c2db7c35e66e4b7e5de67e0]
Former-commit-id: 1b13473bce40de27aafaf2707eeda8feaa46a39d

notebooks/audiobook_gen_silero.ipynb CHANGED
@@ -313,7 +313,7 @@
313
  ],
314
  "metadata": {
315
  "kernelspec": {
316
- "display_name": "Python 3",
317
  "language": "python",
318
  "name": "python3"
319
  },
 
313
  ],
314
  "metadata": {
315
  "kernelspec": {
316
+ "display_name": "Python 3 (ipykernel)",
317
  "language": "python",
318
  "name": "python3"
319
  },
notebooks/parser_function_html.ipynb CHANGED
@@ -2,17 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
- "id": "27a75ece",
7
- "metadata": {},
8
- "outputs": [],
9
- "source": [
10
- "import nltk"
11
- ]
12
- },
13
- {
14
- "cell_type": "code",
15
- "execution_count": null,
16
  "id": "5292a160",
17
  "metadata": {},
18
  "outputs": [],
@@ -27,18 +17,18 @@
27
  },
28
  {
29
  "cell_type": "code",
30
- "execution_count": null,
31
  "id": "68609a77",
32
  "metadata": {},
33
  "outputs": [],
34
  "source": [
35
  "# file_path = '1232-h.htm'\n",
36
- "file_path = 'test.htm'"
37
  ]
38
  },
39
  {
40
  "cell_type": "code",
41
- "execution_count": null,
42
  "id": "5c526c9b",
43
  "metadata": {},
44
  "outputs": [],
@@ -49,7 +39,7 @@
49
  },
50
  {
51
  "cell_type": "code",
52
- "execution_count": null,
53
  "id": "d4732304",
54
  "metadata": {},
55
  "outputs": [],
@@ -102,34 +92,77 @@
102
  },
103
  {
104
  "cell_type": "code",
105
- "execution_count": null,
106
  "id": "ece1c7d3",
107
  "metadata": {},
108
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
109
  "source": [
110
  "np.shape(corpus)"
111
  ]
112
  },
113
  {
114
  "cell_type": "code",
115
- "execution_count": null,
116
  "id": "dc7e4010",
117
  "metadata": {},
118
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
119
  "source": [
120
  "corpus[0][2]"
121
  ]
122
  },
123
  {
124
  "cell_type": "code",
125
- "execution_count": null,
126
  "id": "6cb47a2d",
127
  "metadata": {},
128
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
129
  "source": [
130
  "corpus"
131
  ]
132
  },
 
 
 
 
 
 
 
 
133
  {
134
  "cell_type": "code",
135
  "execution_count": null,
@@ -367,7 +400,7 @@
367
  ],
368
  "metadata": {
369
  "kernelspec": {
370
- "display_name": "Python 3",
371
  "language": "python",
372
  "name": "python3"
373
  },
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 2,
 
 
 
 
 
 
 
 
 
 
6
  "id": "5292a160",
7
  "metadata": {},
8
  "outputs": [],
 
17
  },
18
  {
19
  "cell_type": "code",
20
+ "execution_count": 3,
21
  "id": "68609a77",
22
  "metadata": {},
23
  "outputs": [],
24
  "source": [
25
  "# file_path = '1232-h.htm'\n",
26
+ "file_path = ''"
27
  ]
28
  },
29
  {
30
  "cell_type": "code",
31
+ "execution_count": 4,
32
  "id": "5c526c9b",
33
  "metadata": {},
34
  "outputs": [],
 
39
  },
40
  {
41
  "cell_type": "code",
42
+ "execution_count": 5,
43
  "id": "d4732304",
44
  "metadata": {},
45
  "outputs": [],
 
92
  },
93
  {
94
  "cell_type": "code",
95
+ "execution_count": 11,
96
  "id": "ece1c7d3",
97
  "metadata": {},
98
+ "outputs": [
99
+ {
100
+ "data": {
101
+ "text/plain": [
102
+ "(1, 2)"
103
+ ]
104
+ },
105
+ "execution_count": 11,
106
+ "metadata": {},
107
+ "output_type": "execute_result"
108
+ }
109
+ ],
110
  "source": [
111
  "np.shape(corpus)"
112
  ]
113
  },
114
  {
115
  "cell_type": "code",
116
+ "execution_count": 12,
117
  "id": "dc7e4010",
118
  "metadata": {},
119
+ "outputs": [
120
+ {
121
+ "ename": "IndexError",
122
+ "evalue": "list index out of range",
123
+ "output_type": "error",
124
+ "traceback": [
125
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
126
+ "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
127
+ "Cell \u001b[0;32mIn [12], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mcorpus\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m\n",
128
+ "\u001b[0;31mIndexError\u001b[0m: list index out of range"
129
+ ]
130
+ }
131
+ ],
132
  "source": [
133
  "corpus[0][2]"
134
  ]
135
  },
136
  {
137
  "cell_type": "code",
138
+ "execution_count": 13,
139
  "id": "6cb47a2d",
140
  "metadata": {},
141
+ "outputs": [
142
+ {
143
+ "data": {
144
+ "text/plain": [
145
+ "[['Predict Testing Text File',\n",
146
+ " 'Audiobook Gen is a tool that allows the users to generate an audio file from an ebook or other document.']]"
147
+ ]
148
+ },
149
+ "execution_count": 13,
150
+ "metadata": {},
151
+ "output_type": "execute_result"
152
+ }
153
+ ],
154
  "source": [
155
  "corpus"
156
  ]
157
  },
158
+ {
159
+ "cell_type": "code",
160
+ "execution_count": null,
161
+ "id": "8508b073",
162
+ "metadata": {},
163
+ "outputs": [],
164
+ "source": []
165
+ },
166
  {
167
  "cell_type": "code",
168
  "execution_count": null,
 
400
  ],
401
  "metadata": {
402
  "kernelspec": {
403
+ "display_name": "Python 3 (ipykernel)",
404
  "language": "python",
405
  "name": "python3"
406
  },
tests/data/test_predict.pt ADDED
Binary file (680 kB). View file
 
tests/data/test_predict.pt.REMOVED.git-id DELETED
@@ -1 +0,0 @@
1
- 8b8527f845edc4a379248e2123bff052d686d9c8
 
 
tests/data/test_predict.txt CHANGED
@@ -1,5 +1,3 @@
1
  Predict Testing Text File
2
 
3
- Audiobook Gen is a tool that allows the users to generate an audio file of text (e.g. audiobook), read in the voice of the user's choice. This tool is based on the Silero text-to-speech toolkit and uses Streamlit to deliver the application.
4
-
5
- This tool generates custom-voiced audiobook files from an imported ebook file. Please upload an ebook to begin the conversion process. Output files will be downloaded as a .zip archive.
 
1
  Predict Testing Text File
2
 
3
+ Audiobook Gen is a tool that allows the users to generate an audio file from an ebook or other document.
 
 
tests/test_predict.py CHANGED
@@ -57,9 +57,9 @@ def test_predict():
57
  text = file_readers.preprocess_text(file)
58
  title = 'test_predict'
59
  section_index = 'part001'
60
- speaker = 'en_110'
61
 
62
  audio_list, _ = predict.predict(text, section_index, title, model, speaker)
63
  audio_tensor = torch.cat(audio_list).reshape(1, -1)
64
 
65
- torch.testing.assert_close(audio_tensor, test_tensor, atol=1e-4, rtol=0.01)
 
57
  text = file_readers.preprocess_text(file)
58
  title = 'test_predict'
59
  section_index = 'part001'
60
+ speaker = 'en_0'
61
 
62
  audio_list, _ = predict.predict(text, section_index, title, model, speaker)
63
  audio_tensor = torch.cat(audio_list).reshape(1, -1)
64
 
65
+ torch.testing.assert_close(audio_tensor, test_tensor, atol=1e-3, rtol=0.9)