hivecorp commited on
Commit
c83e36a
·
verified ·
1 Parent(s): 458d8c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,9 +3,9 @@ from transformers import pipeline
3
 
4
  # Define a list of available speaker models
5
  SPEAKER_MODELS = {
6
- "Default": "kokoro/tts-default",
7
- "Speaker 1": "kokoro/tts-speaker1",
8
- "Speaker 2": "kokoro/tts-speaker2"
9
  }
10
 
11
  def kokoro_tts(text, speaker):
@@ -13,7 +13,7 @@ def kokoro_tts(text, speaker):
13
  tts_pipeline = pipeline("text-to-speech", model=SPEAKER_MODELS[speaker])
14
  # Generate speech from text
15
  speech = tts_pipeline(text)
16
- return speech["waveform"]
17
 
18
  # Create a Gradio interface
19
  iface = gr.Interface(
@@ -24,7 +24,7 @@ iface = gr.Interface(
24
  ],
25
  outputs=gr.Audio(label="Generated Speech"),
26
  title="Kokoro Text-to-Speech",
27
- description="A Text-to-Speech app powered by Kokoro and Transformers.js with multiple speaker options"
28
  )
29
 
30
  if __name__ == "__main__":
 
3
 
4
  # Define a list of available speaker models
5
  SPEAKER_MODELS = {
6
+ "Default": "onnx-community/Kokoro-82M-ONNX",
7
+ "Speaker 1": "onnx-community/Kokoro-82M-ONNX",
8
+ "Speaker 2": "onnx-community/Kokoro-82M-ONNX"
9
  }
10
 
11
  def kokoro_tts(text, speaker):
 
13
  tts_pipeline = pipeline("text-to-speech", model=SPEAKER_MODELS[speaker])
14
  # Generate speech from text
15
  speech = tts_pipeline(text)
16
+ return speech["audio"]
17
 
18
  # Create a Gradio interface
19
  iface = gr.Interface(
 
24
  ],
25
  outputs=gr.Audio(label="Generated Speech"),
26
  title="Kokoro Text-to-Speech",
27
+ description="A Text-to-Speech app powered by Hugging Face Transformers.js with multiple speaker options"
28
  )
29
 
30
  if __name__ == "__main__":