ganga4364 commited on
Commit
3cd13ab
·
verified ·
1 Parent(s): bfb8ce2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -4,7 +4,7 @@ import soundfile as sf
4
  import uuid
5
  import datetime
6
  import shutil
7
- from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
8
  import scipy.io.wavfile
9
  import numpy as np
10
 
@@ -71,13 +71,9 @@ def tts_tibetan(input_text):
71
  # Perform TTS inference for each sentence
72
  speech = synthesiser(sentence)
73
 
74
- # Extract the audio data and sampling rate from the pipeline output
75
- audio_data = np.array(speech["audio"])
76
- sample_rate = speech["sampling_rate"]
77
-
78
  # Save each sentence as a separate WAV file
79
  wav_path = f"{user_dir}/s_{str(i).zfill(10)}.wav"
80
- scipy.io.wavfile.write(wav_path, rate=sample_rate, data=audio_data.astype(np.int16)) # Ensure correct format
81
 
82
  # Combine the generated audio into one file
83
  combined_file_path = combine_wav(user_dir, timestamp)
 
4
  import uuid
5
  import datetime
6
  import shutil
7
+ from transformers import pipeline
8
  import scipy.io.wavfile
9
  import numpy as np
10
 
 
71
  # Perform TTS inference for each sentence
72
  speech = synthesiser(sentence)
73
 
 
 
 
 
74
  # Save each sentence as a separate WAV file
75
  wav_path = f"{user_dir}/s_{str(i).zfill(10)}.wav"
76
+ scipy.io.wavfile.write(wav_path, rate=speech["sampling_rate"], data=speech["audio"][0])
77
 
78
  # Combine the generated audio into one file
79
  combined_file_path = combine_wav(user_dir, timestamp)