ford442 commited on
Commit
2dbdb2a
·
verified ·
1 Parent(s): 97a0fb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -33,36 +33,7 @@ def _preload_and_load_models():
33
 
34
  _preload_and_load_models()
35
 
36
-
37
- # Load the TTS model locally
38
- TTS_MODEL_PATH = "path/to/your/espnet/kan-bayashi_ljspeech_vits" # Replace with the actual path
39
- TTS_CONFIG_PATH = os.path.join(TTS_MODEL_PATH, "config.yaml") # Replace with your config.yaml
40
- TTS_VOCAB_PATH = os.path.join(TTS_MODEL_PATH, "train.json") # Replace with your train.json
41
-
42
- # Load the configuration using yaml
43
- with open(TTS_CONFIG_PATH, "r") as f:
44
- config = yaml.safe_load(f)
45
-
46
- # Correctly handle the threshold parameter
47
- threshold = config.get("threshold", 0.5) # Get threshold, default to 0.5 if not found
48
- if isinstance(threshold, str): # Check if it's a string
49
- try:
50
- threshold = float(threshold) # Try converting to float
51
- except ValueError:
52
- threshold = 0.5 # If conversion fails, use a default value
53
-
54
-
55
- tts = Text2Speech(
56
- TTS_MODEL_PATH,
57
- TTS_CONFIG_PATH,
58
- TTS_VOCAB_PATH,
59
- device="cuda" if torch.cuda.is_available() else "cpu",
60
- threshold=threshold # Pass the corrected threshold value
61
- )
62
- fastspeech_config = get_fastspeech_config(TTS_CONFIG_PATH)
63
-
64
-
65
-
66
 
67
  @spaces.GPU(required=True)
68
  def process_audio(microphone, state, task="transcribe"):
 
33
 
34
  _preload_and_load_models()
35
 
36
+ tts = Text2Speech.from_pretrained("espnet/kan-bayashi_ljspeech_vits")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  @spaces.GPU(required=True)
39
  def process_audio(microphone, state, task="transcribe"):