Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,16 +78,12 @@ def generate(audio_text, history, temperature=None, max_new_tokens=512, top_p=0.
|
|
78 |
return response, audio_file
|
79 |
|
80 |
def text_to_speech(text, speed=1.3):
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
return base64.b64encode(encoded).decode()
|
88 |
-
except TeotronEngineError as e:
|
89 |
-
print(f"Teotron error: {str(e)}")
|
90 |
-
return None
|
91 |
|
92 |
def main():
|
93 |
audio_data = audiorecorder("Push to Play", "Stop Recording...")
|
|
|
78 |
return response, audio_file
|
79 |
|
80 |
def text_to_speech(text, speed=1.3):
|
81 |
+
tts = gTTS(text=text, lang='es')
|
82 |
+
tts.speed = speed
|
83 |
+
audio_bytes = io.BytesIO()
|
84 |
+
tts.write_to_fp(audio_bytes)
|
85 |
+
audio_bytes.seek(0)
|
86 |
+
return base64.b64encode(audio_bytes.read()).decode()
|
|
|
|
|
|
|
|
|
87 |
|
88 |
def main():
|
89 |
audio_data = audiorecorder("Push to Play", "Stop Recording...")
|