Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,15 +18,19 @@ import pyttsx3
|
|
| 18 |
import tempfile
|
| 19 |
|
| 20 |
# --------------------------
|
| 21 |
-
|
|
|
|
| 22 |
# --------------------------
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
def speak_text_to_audio(text):
|
| 26 |
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return fp.name # Gradio Audio
|
|
|
|
| 30 |
|
| 31 |
# --------------------------
|
| 32 |
# Load Quantized LLaMA 2 via AutoGPTQ
|
|
|
|
| 18 |
import tempfile
|
| 19 |
|
| 20 |
# --------------------------
|
| 21 |
+
|
| 22 |
+
# Text-to-Speech Setup (gTTS version)
|
| 23 |
# --------------------------
|
| 24 |
+
from gtts import gTTS
|
| 25 |
+
import tempfile
|
| 26 |
+
import os
|
| 27 |
|
| 28 |
def speak_text_to_audio(text):
|
| 29 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as fp:
|
| 30 |
+
tts = gTTS(text=text, lang='en')
|
| 31 |
+
tts.save(fp.name)
|
| 32 |
+
return fp.name # Gradio Audio can use this path
|
| 33 |
+
|
| 34 |
|
| 35 |
# --------------------------
|
| 36 |
# Load Quantized LLaMA 2 via AutoGPTQ
|