ganga4364 commited on
Commit
88385cb
·
verified ·
1 Parent(s): d16456b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -15,14 +15,9 @@ synthesiser = pipeline("text-to-speech", model_id) # add device=0 if you want to
15
  def generate_audio(input_text):
16
  # Perform TTS inference
17
  speech = synthesiser(input_text)
18
-
19
- # Extract the audio data and sampling rate from the pipeline output
20
- audio_data = np.array(speech["audio"])
21
- sample_rate = speech["sampling_rate"]
22
-
23
  # Save the audio to a file (e.g., 'output.wav')
24
- file_path = "output_tibetan.wav"
25
- scipy.io.wavfile.write(file_path, rate=sample_rate, data=audio_data.astype(np.int16)) # Ensure correct format
26
 
27
  # Return the path to the audio file
28
  return file_path
 
15
  def generate_audio(input_text):
16
  # Perform TTS inference
17
  speech = synthesiser(input_text)
18
+ file_path = "finetuned_output.wav"
 
 
 
 
19
  # Save the audio to a file (e.g., 'output.wav')
20
+ scipy.io.wavfile.write(file_path, rate=speech["sampling_rate"], data=speech["audio"][0])
 
21
 
22
  # Return the path to the audio file
23
  return file_path