John Langley commited on
Commit
052da48
1 Parent(s): ce8d3a6

change to cpu

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. utils.py +5 -2
app.py CHANGED
@@ -176,7 +176,8 @@ with gr.Blocks(title="Voice chat with LLM") as demo:
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
 
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)
180
+ #yield (sentence, chatbot_history, audio_dict["value"])
181
 
182
  if initial_greeting:
183
  # Process only the initial greeting if specified
utils.py CHANGED
@@ -421,10 +421,13 @@ def generate_speech_for_sentence(history, chatbot_voice, sentence, xtts_model, x
421
  f.setsampwidth(2)
422
  f.setframerate(24000)
423
  f.writeframes(wav_bytestream)
 
 
424
 
425
- return (history , gr.Audio(value=audio_unique_filename, autoplay=True))
426
  else:
427
- return (history , gr.Audio(value=wav_bytestream, autoplay=True))
 
428
  except RuntimeError as e:
429
  if "device-side assert" in str(e):
430
  # cannot do anything on cuda device side error, need tor estart
 
421
  f.setsampwidth(2)
422
  f.setframerate(24000)
423
  f.writeframes(wav_bytestream)
424
+
425
+ return audio_unique_filename
426
 
427
+ #return (history , gr.Audio.update(value=audio_unique_filename, autoplay=True))
428
  else:
429
+ return wav_bytestream
430
+ #return (history , gr.Audio.update(value=wav_bytestream, autoplay=True))
431
  except RuntimeError as e:
432
  if "device-side assert" in str(e):
433
  # cannot do anything on cuda device side error, need tor estart