John Langley commited on
Commit
eaad3e8
1 Parent(s): 4bae818

change to cpu

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -172,18 +172,11 @@ with gr.Blocks(title="Voice chat with LLM") as demo:
172
  def handle_speech_generation(sentence, chatbot_history, chatbot_voice):
173
  if sentence != "":
174
  print("Processing sentence")
175
- # generate speech by cloning a voice using default settings
176
- xtts_model.tts_to_file(text="It took me quite a long time to develop a voice, and now that I have it I'm not going to be silent.",
177
- file_path="output.wav",
178
- speaker_wav=[f"examples/{chatbot_voice}.wav"],
179
- language="en",
180
- split_sentences=True
181
- )
182
- yield (sentence, chatbot_history, wave_header_chunk())
183
- #generated_speech = generate_speech_for_sentence(chatbot_history, chatbot_voice, sentence, xtts_model, None, return_as_byte=True)
184
- #if generated_speech is not None:
185
- # _, audio_dict = generated_speech
186
- # yield (sentence, chatbot_history, audio_dict["value"])
187
 
188
  if initial_greeting:
189
  # Process only the initial greeting if specified
 
172
  def handle_speech_generation(sentence, chatbot_history, chatbot_voice):
173
  if sentence != "":
174
  print("Processing sentence")
175
+ # generate speech by cloning a voice using default setting
176
+ generated_speech = generate_speech_for_sentence(chatbot_history, chatbot_voice, sentence, xtts_model, None, return_as_byte=True)
177
+ if generated_speech is not None:
178
+ _, audio_dict = generated_speech
179
+ yield (sentence, chatbot_history, audio_dict["value"])
 
 
 
 
 
 
 
180
 
181
  if initial_greeting:
182
  # Process only the initial greeting if specified