Remsky commited on
Commit
3a912ba
·
1 Parent(s): 47dfb0a

Update TTSModel to verify local voice files and handle missing downloads

Browse files
.gitignore CHANGED
@@ -1,7 +1,7 @@
1
  dorian_grey.txt
2
  texts/time_machine.txt
3
  *.pyc
4
- *.pt
5
 
6
  # Audio files
7
 
 
1
  dorian_grey.txt
2
  texts/time_machine.txt
3
  *.pyc
4
+
5
 
6
  # Audio files
7
 
tts_model.py CHANGED
@@ -52,8 +52,10 @@ class TTSModel:
52
  )
53
  self.model_path = model_files[0] # kokoro-v0_19.pth
54
 
55
- # Download voice files from v0.19 directory
56
- download_voice_files(self.model_repo, "v0.19/voices", self.voices_dir)
 
 
57
 
58
  # Verify voices were downloaded successfully
59
  available_voices = self.list_voices()
@@ -70,16 +72,12 @@ class TTSModel:
70
  return False
71
 
72
  def ensure_voice_downloaded(self, voice_name: str) -> bool:
73
- """Ensure specific voice is downloaded"""
74
- try:
75
- voice_path = os.path.join(self.voices_dir, "voices", f"{voice_name}.pt")
76
- if not os.path.exists(voice_path):
77
- print(f"Downloading voice {voice_name}.pt...")
78
- download_voice_files(self.model_repo, [f"v0.19/voices/{voice_name}.pt"], self.voices_dir)
79
- return True
80
- except Exception as e:
81
- print(f"Error downloading voice {voice_name}: {str(e)}")
82
  return False
 
83
 
84
  def list_voices(self) -> List[str]:
85
  """List available voices"""
 
52
  )
53
  self.model_path = model_files[0] # kokoro-v0_19.pth
54
 
55
+ # Verify local voice files are available
56
+ voices_dir = os.path.join(self.voices_dir, "voices")
57
+ if not os.path.exists(voices_dir):
58
+ raise ValueError("Voice files not found. Please run scripts/download_voices.py first")
59
 
60
  # Verify voices were downloaded successfully
61
  available_voices = self.list_voices()
 
72
  return False
73
 
74
  def ensure_voice_downloaded(self, voice_name: str) -> bool:
75
+ """Check if specific voice file exists locally"""
76
+ voice_path = os.path.join(self.voices_dir, "voices", f"{voice_name}.pt")
77
+ if not os.path.exists(voice_path):
78
+ print(f"Voice file {voice_name}.pt not found. Please run scripts/download_voices.py first")
 
 
 
 
 
79
  return False
80
+ return True
81
 
82
  def list_voices(self) -> List[str]:
83
  """List available voices"""
voices/voices/af.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fad4192fd8a840f925b0e3fc2be54e20531f91a9ac816a485b7992ca0bd83ebf
3
+ size 524355
voices/voices/af_bella.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2828c6c2f94275ef3441a2edfcf48293298ee0f9b56ce70fb2e344345487b922
3
+ size 524449
voices/voices/af_irulan.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:520c314976fd63fb4fed311a61dfc44bf813c2207b89020295bc4aa50014707e
3
+ size 524484
voices/voices/af_nicole.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9401802fb0b7080c324dec1a75d60f31d977ced600a99160e095dbc5a1172692
3
+ size 524454
voices/voices/af_sarah.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba7918c4ace6ace4221e7e01eb3a6d16596cba9729850551c758cd2ad3a4cd08
3
+ size 524449
voices/voices/af_sky.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f16f1bb778de36a177ae4b0b6f1e59783d5f4d3bcecf752c3e1ee98299b335e
3
+ size 524375
voices/voices/am_adam.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1921528b400a553f66528c27899d95780918fe33b1ac7e2a871f6a0de475f176
3
+ size 524444
voices/voices/am_gurney.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a29ae339e9e235a2048a52717dd8f8b38cf19c088a16b95a63fb60369c0355e
3
+ size 524474
voices/voices/am_michael.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a255c9562c363103adc56c09b7daf837139d3bdaa8bd4dd74847ab1e3e8c28be
3
+ size 524459
voices/voices/bf_emma.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:992e6d8491b8926ef4a16205250e51a21d9924405a5d37e2db6e94adfd965c3b
3
+ size 524365
voices/voices/bf_isabella.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d0865a03931230100167f7a81d394b143c072efe2d7e4c4a87b5c54d6283f580
3
+ size 524365
voices/voices/bm_george.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d763dfe13e934357f4d8322b718787d79e32f2181e29ca0cf6aa637d8092b96
3
+ size 524464
voices/voices/bm_lewis.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f70d9ea4d65f522f224628f06d86ea74279faae23bd7e765848a374aba916b76
3
+ size 524449