freddyaboulton HF Staff commited on
Commit
3d9332b
·
verified ·
1 Parent(s): 353e095

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -12,8 +12,8 @@ from fastrtc import (
12
  AdditionalOutputs,
13
  ReplyOnPause,
14
  Stream,
15
- get_twilio_turn_credentials,
16
  get_tts_model,
 
17
  )
18
  from fastrtc.utils import aggregate_bytes_to_16bit, audio_to_bytes
19
  from gradio.utils import get_space
@@ -57,8 +57,15 @@ def response(
57
  )
58
  chatbot.append({"role": "assistant", "content": response_text})
59
  yield AdditionalOutputs(chatbot)
60
- for chunk in tts_model.stream_tts_sync(response_text):
 
 
 
 
 
 
61
  yield chunk
 
62
 
63
 
64
  chatbot = gr.Chatbot(type="messages")
 
12
  AdditionalOutputs,
13
  ReplyOnPause,
14
  Stream,
 
15
  get_tts_model,
16
+ get_twilio_turn_credentials,
17
  )
18
  from fastrtc.utils import aggregate_bytes_to_16bit, audio_to_bytes
19
  from gradio.utils import get_space
 
57
  )
58
  chatbot.append({"role": "assistant", "content": response_text})
59
  yield AdditionalOutputs(chatbot)
60
+ import time
61
+
62
+ start = time.time()
63
+
64
+ print("starting tts", start)
65
+ for i, chunk in enumerate(tts_model.stream_tts_sync(response_text)):
66
+ print("chunk", i, time.time() - start)
67
  yield chunk
68
+ print("finished tts", time.time() - start)
69
 
70
 
71
  chatbot = gr.Chatbot(type="messages")