parvezalmuqtadir commited on
Commit
a1e494d
1 Parent(s): f85fb1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -89,11 +89,12 @@ def render_file(file):
89
  image = Image.frombytes('RGB', [pix.width, pix.height], pix.samples)
90
  return image
91
 
92
- # Function to generate speech from text
 
93
  def generate_speech(text):
94
- tts = gTTS(text=text, lang='en')
95
- tts.save("output.mp3")
96
- play_sound("output.mp3")
97
 
98
  def play_sound(file_path):
99
  try:
 
89
  image = Image.frombytes('RGB', [pix.width, pix.height], pix.samples)
90
  return image
91
 
92
+ import pyttsx3
93
+
94
  def generate_speech(text):
95
+ engine = pyttsx3.init()
96
+ engine.say(text)
97
+ engine.runAndWait()
98
 
99
  def play_sound(file_path):
100
  try: