parvezalmuqtadir commited on
Commit
126529d
1 Parent(s): a1e494d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -89,12 +89,11 @@ def render_file(file):
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:
 
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: