Nymbo commited on
Commit
3fc7265
·
verified ·
1 Parent(s): de3ed0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -25,8 +25,8 @@ def _init_kokoro() -> None:
25
 
26
  device = "cuda" if torch.cuda.is_available() else "cpu"
27
  print(f"Using device: {device}")
28
- model = KModel().to(device).eval()
29
- pipelines = {"a": KPipeline(lang_code="a", model=False)}
30
  try:
31
  pipelines["a"].g2p.lexicon.golds["kokoro"] = "kˈOkəɹO"
32
  except Exception:
@@ -141,7 +141,7 @@ def generate_tts(text: str, speed: float, voice: str):
141
  yield from kokoro_tts_stream(text, speed, voice)
142
 
143
 
144
- with gr.Blocks(theme='Nymbo/Nymbo_Theme') as demo:
145
  gr.HTML("<h1 style='text-align: center;'>Kokoro-TTS</h1><p style='text-align: center;'>Powered by Kokoro-82M on CPU</p>")
146
 
147
  available_voices = get_kokoro_voices()
@@ -179,7 +179,7 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme') as demo:
179
  label="Generated Speech",
180
  streaming=True,
181
  autoplay=True,
182
- show_download_button=True,
183
  )
184
 
185
  generate_inputs = [text_input, kokoro_speed, kokoro_voice]
@@ -198,4 +198,5 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme') as demo:
198
  api_name="generate_speech_enter"
199
  )
200
 
201
- demo.queue().launch(debug=True)
 
 
25
 
26
  device = "cuda" if torch.cuda.is_available() else "cpu"
27
  print(f"Using device: {device}")
28
+ model = KModel(repo_id="hexgrad/Kokoro-82M").to(device).eval()
29
+ pipelines = {"a": KPipeline(lang_code="a", model=False, repo_id="hexgrad/Kokoro-82M")}
30
  try:
31
  pipelines["a"].g2p.lexicon.golds["kokoro"] = "kˈOkəɹO"
32
  except Exception:
 
141
  yield from kokoro_tts_stream(text, speed, voice)
142
 
143
 
144
+ with gr.Blocks() as demo:
145
  gr.HTML("<h1 style='text-align: center;'>Kokoro-TTS</h1><p style='text-align: center;'>Powered by Kokoro-82M on CPU</p>")
146
 
147
  available_voices = get_kokoro_voices()
 
179
  label="Generated Speech",
180
  streaming=True,
181
  autoplay=True,
182
+ buttons=["download"],
183
  )
184
 
185
  generate_inputs = [text_input, kokoro_speed, kokoro_voice]
 
198
  api_name="generate_speech_enter"
199
  )
200
 
201
+ if __name__ == "__main__":
202
+ demo.queue().launch(debug=True, theme='Nymbo/Nymbo_Theme')