high77 commited on
Commit
668481e
·
verified ·
1 Parent(s): 9eb56b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -96,13 +96,8 @@ def synthesize_speech(text, ref_audio, ref_text):
96
  sf.write(temp_audio.name, audio_data, samplerate=sample_rate, format='WAV')
97
  temp_audio.flush()
98
 
99
- # Load with soundfile (not torchaudio) and convert to tensor
100
- wav, sr = sf.read(temp_audio.name)
101
- wav = torch.from_numpy(wav).float()
102
- if sr != 24000:
103
- wav = torchaudio.functional.resample(wav, sr, 24000)
104
- # Feed tensor directly to model – never touches torchaudio.load
105
- out = model(text, ref_audio=wav.unsqueeze(0), ref_text=ref_text)
106
 
107
  # Normalize output and save
108
  if out.dtype == np.int16:
 
96
  sf.write(temp_audio.name, audio_data, samplerate=sample_rate, format='WAV')
97
  temp_audio.flush()
98
 
99
+ # Use the **original** signature never change it
100
+ out = model(text, ref_audio_path=temp_audio.name, ref_text=ref_text)
 
 
 
 
 
101
 
102
  # Normalize output and save
103
  if out.dtype == np.int16: