Michael Hu commited on
Commit
5a72681
·
1 Parent(s): 724aa35

try to use kokoro api server as backup

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -0
  2. utils/tts.py +8 -0
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  streamlit>=1.44.1
 
2
  nltk>=3.8
3
  librosa>=0.10
4
  ffmpeg-python>=0.2
 
1
  streamlit>=1.44.1
2
+ gradio==5.9.1
3
  nltk>=3.8
4
  librosa>=0.10
5
  ffmpeg-python>=0.2
utils/tts.py CHANGED
@@ -2,6 +2,8 @@ import os
2
  import logging
3
  import time
4
  import soundfile as sf
 
 
5
 
6
  logger = logging.getLogger(__name__)
7
 
@@ -18,6 +20,12 @@ except AttributeError as e:
18
  # Specifically catch the EspeakWrapper.set_data_path error
19
  if "EspeakWrapper" in str(e) and "set_data_path" in str(e):
20
  logger.warning("Kokoro import failed due to EspeakWrapper.set_data_path issue")
 
 
 
 
 
 
21
  else:
22
  # Re-raise if it's a different error
23
  logger.error(f"Kokoro import failed with unexpected error: {str(e)}")
 
2
  import logging
3
  import time
4
  import soundfile as sf
5
+ from gradio_client import Client
6
+
7
 
8
  logger = logging.getLogger(__name__)
9
 
 
20
  # Specifically catch the EspeakWrapper.set_data_path error
21
  if "EspeakWrapper" in str(e) and "set_data_path" in str(e):
22
  logger.warning("Kokoro import failed due to EspeakWrapper.set_data_path issue")
23
+ logger.info("Try to use Kokoro FastAPI server")
24
+ client = Client("Remsky/Kokoro-TTS-Zero")
25
+ result = client.predict(
26
+ api_name="/lambda"
27
+ )
28
+ print(f"result get back from Kokora FastAPI server: {result}")
29
  else:
30
  # Re-raise if it's a different error
31
  logger.error(f"Kokoro import failed with unexpected error: {str(e)}")