mkutarna commited on
Commit
50d21df
·
1 Parent(s): 74f2c64

Reduced test_predict tensor file in size

Browse files

Former-commit-id: 88f4bf38e14dca73c664c1b42ff2e9fe1276158e [formerly 9bfa829f28fc522a8c8a6dcb32f00b47375a0eb1]
Former-commit-id: 373cb379bf19d67211a38abe7fc69b5b20f5bb0a

tests/data/test_predict.pt.REMOVED.git-id CHANGED
@@ -1 +1 @@
1
- 84cf0cd8d8bede5ff60d18475d71e26543d5d7ad
 
1
+ 8b8527f845edc4a379248e2123bff052d686d9c8
tests/data/test_predict.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
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.
tests/test_predict.py CHANGED
@@ -52,12 +52,14 @@ def test_predict():
52
  tensor_path = test_config.data_path / "test_predict.pt"
53
  test_tensor = torch.load(tensor_path)
54
 
55
- ebook_path = test_config.data_path / "test.epub"
56
- corpus, title = file_readers.read_epub(ebook_path)
 
 
57
  section_index = 'part001'
58
  speaker = 'en_110'
59
 
60
- audio_list, _ = predict.predict(corpus[1], section_index, title, model, speaker)
61
  audio_tensor = torch.cat(audio_list).reshape(1, -1)
62
 
63
- torch.testing.assert_close(audio_tensor, test_tensor, atol=1e-3, rtol=0.2)
 
52
  tensor_path = test_config.data_path / "test_predict.pt"
53
  test_tensor = torch.load(tensor_path)
54
 
55
+ text_path = test_config.data_path / "test_predict.txt"
56
+ with open(text_path, 'r') as file:
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)