Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from llama_cpp import Llama
|
3 |
import os
|
4 |
from groq import Groq
|
|
|
5 |
|
6 |
#tts
|
7 |
from balacoon_tts import TTS
|
@@ -99,7 +100,7 @@ async def greet(product,description):
|
|
99 |
tts = TTS(os.path.join(os.getcwd(), tts_model_str))
|
100 |
a_list = ["Sorry, I can't proceed for generating marketing email. Your content needs to be moderated first. Thank you!"]
|
101 |
with locker:
|
102 |
-
audio_stream.write(tts.synthesize(a_list[0], speaker_str))
|
103 |
audio_stream.seek(0)
|
104 |
yield audio_stream
|
105 |
else:
|
@@ -122,7 +123,7 @@ async def greet(product,description):
|
|
122 |
delta = chunk['choices'][0]['delta']
|
123 |
if 'content' in delta:
|
124 |
with locker:
|
125 |
-
audio_stream.write(tts.synthesize(delta.get('content', ''), speaker_str))
|
126 |
# partial_message = partial_message + delta.get('content', '')
|
127 |
# yield partial_message
|
128 |
audio_stream.seek(0)
|
|
|
2 |
from llama_cpp import Llama
|
3 |
import os
|
4 |
from groq import Groq
|
5 |
+
import numpy
|
6 |
|
7 |
#tts
|
8 |
from balacoon_tts import TTS
|
|
|
100 |
tts = TTS(os.path.join(os.getcwd(), tts_model_str))
|
101 |
a_list = ["Sorry, I can't proceed for generating marketing email. Your content needs to be moderated first. Thank you!"]
|
102 |
with locker:
|
103 |
+
audio_stream.write(numpy.ascontiguousarray(tts.synthesize(a_list[0], speaker_str)))
|
104 |
audio_stream.seek(0)
|
105 |
yield audio_stream
|
106 |
else:
|
|
|
123 |
delta = chunk['choices'][0]['delta']
|
124 |
if 'content' in delta:
|
125 |
with locker:
|
126 |
+
audio_stream.write(numpy.ascontiguousarray(tts.synthesize(delta.get('content', ''), speaker_str)))
|
127 |
# partial_message = partial_message + delta.get('content', '')
|
128 |
# yield partial_message
|
129 |
audio_stream.seek(0)
|