edwko commited on
Commit
18a86b4
·
verified ·
1 Parent(s): 050e74d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -3,22 +3,25 @@ import gradio as gr
3
  import outetts
4
  from outetts.version.v2.interface import _DEFAULT_SPEAKERS
5
  import torch
6
-
7
- model_config = outetts.HFModelConfig_v2(
8
- model_path="OuteAI/OuteTTS-0.3-1B",
9
- tokenizer_path="OuteAI/OuteTTS-0.3-1B",
10
- dtype=torch.bfloat16
11
- )
12
- interface = outetts.InterfaceHF(model_version="0.3", cfg=model_config)
13
 
14
  def get_available_speakers():
15
  speakers = list(_DEFAULT_SPEAKERS.keys())
16
  return speakers
17
 
 
18
  def generate_tts(
19
  text, temperature, repetition_penalty,
20
  speaker_selection, reference_audio
21
  ):
 
 
 
 
 
 
 
 
22
  """Generate TTS with error handling and new features."""
23
  try:
24
  # Validate inputs for custom speaker
 
3
  import outetts
4
  from outetts.version.v2.interface import _DEFAULT_SPEAKERS
5
  import torch
6
+ import spaces
 
 
 
 
 
 
7
 
8
  def get_available_speakers():
9
  speakers = list(_DEFAULT_SPEAKERS.keys())
10
  return speakers
11
 
12
+ @spaces.GPU
13
  def generate_tts(
14
  text, temperature, repetition_penalty,
15
  speaker_selection, reference_audio
16
  ):
17
+
18
+ model_config = outetts.HFModelConfig_v2(
19
+ model_path="OuteAI/OuteTTS-0.3-1B",
20
+ tokenizer_path="OuteAI/OuteTTS-0.3-1B",
21
+ dtype=torch.bfloat16
22
+ )
23
+ interface = outetts.InterfaceHF(model_version="0.3", cfg=model_config)
24
+
25
  """Generate TTS with error handling and new features."""
26
  try:
27
  # Validate inputs for custom speaker