Fralet commited on
Commit
ba5df2e
1 Parent(s): 10d2f3b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -239,12 +239,14 @@ def main():
239
  if __name__ == "__main__":
240
  main()
241
  """
242
- from TTS.api import TTS
243
- tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2", gpu=True)
244
-
245
- # generate speech by cloning a voice using default settings
246
- text_to_audio="A reporter from Gaza, Abdullah Aljamal, who wrote for the American newspaper The Palestine Chronicle, was holding hostages in his home. The Israeli army killed him, and three hostages were rescued from his house. From October 7 to June 8, while the hostages were held captive, Abdullah reported on the horrors of war, highlighting what he described as a genocide by Israel. His last pieces didnt mention that the war started after the October 7 massacre and hostage-taking. Instead, he focused on sick children and elderly people suffering because of Israel. Abdullah was listed as an author on The Palestine Chronicles website. They published articles about his death, denying any involvement in holding hostages. The Palestine Chronicle is run by a nonprofit called People Media. Jason Smith, a Missouri State Representative, believes this organization uses its status to support terrorism. Notably, Noam Chomsky, the famous linguist and leftist philosopher, is an honorary member of The Palestine Chronicles editorial board. He has called the publication an invaluable source of information and analysis about Palestine."
247
- tts.tts_to_file(text=text_to_audio,
248
- file_path="output.wav",
249
- speaker_wav="speaker.wav",
250
- language="en")
 
 
 
239
  if __name__ == "__main__":
240
  main()
241
  """
242
+ import ChatTTS
243
+ import torchaudio
244
+
245
+ chat = ChatTTS.Chat()
246
+ chat.load_models(compile=False) # Set to True for better performance
247
+
248
+ texts = ["A reporter from Gaza, Abdullah Aljamal, who wrote for the American newspaper The Palestine Chronicle, was holding hostages in his home. The Israeli army killed him, and three hostages were rescued from his house. From October 7 to June 8, while the hostages were held captive, Abdullah reported on the horrors of war, highlighting what he described as a genocide by Israel. His last pieces didnt mention that the war started after the October 7 massacre and hostage-taking. Instead, he focused on sick children and elderly people suffering because of Israel. Abdullah was listed as an author on The Palestine Chronicles website. They published articles about his death, denying any involvement in holding hostages. The Palestine Chronicle is run by a nonprofit called People Media. Jason Smith, a Missouri State Representative, believes this organization uses its status to support terrorism. Notably, Noam Chomsky, the famous linguist and leftist philosopher, is an honorary member of The Palestine Chronicles editorial board. He has called the publication an invaluable source of information and analysis about Palestine.",]
249
+
250
+ wavs = chat.infer(texts, )
251
+
252
+ torchaudio.save("output1.wav", torch.from_numpy(wavs[0]), 24000)