quentinbch commited on
Commit
3420952
·
1 Parent(s): 8e3df2d

maj fonction synthesise()

Browse files
Files changed (2) hide show
  1. app.py +10 -6
  2. requirements.txt +0 -0
app.py CHANGED
@@ -102,12 +102,16 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze
102
 
103
  def synthesise(text):
104
  input_ids = processor(text=text, return_tensors="pt")["input_ids"]
105
- speech = model.generate_speech(
106
- input_ids.to(device),
107
- speaker_embeddings.to(device),
108
- vocoder=vocoder
109
- )
110
- return speech.cpu()
 
 
 
 
111
 
112
  # launch_fn(debug=True)
113
  # transcription = transcribe()
 
102
 
103
  def synthesise(text):
104
  input_ids = processor(text=text, return_tensors="pt")["input_ids"]
105
+ try:
106
+ speech = model.generate_speech(
107
+ input_ids.to(device),
108
+ speaker_embeddings.to(device),
109
+ vocoder=vocoder
110
+ )
111
+ return speech.cpu()
112
+ except Exception as e:
113
+ print(f"Erreur lors de la synthèse vocale : {e}")
114
+ return None
115
 
116
  # launch_fn(debug=True)
117
  # transcription = transcribe()
requirements.txt ADDED
File without changes