Add question db insert.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import whisper
|
||||
import os
|
||||
import gtts
|
||||
from playsound import playsound
|
||||
|
||||
def speech_to_text(file_path):
|
||||
if os.path.exists(file_path):
|
||||
@@ -8,4 +10,8 @@ def speech_to_text(file_path):
|
||||
return result["text"]
|
||||
else:
|
||||
print("File not found:", file_path)
|
||||
raise Exception("File " + file_path + " not found.")
|
||||
raise Exception("File " + file_path + " not found.")
|
||||
|
||||
def text_to_speech(text: str, file_name: str):
|
||||
tts = gtts.gTTS(text)
|
||||
tts.save(file_name)
|
||||
Reference in New Issue
Block a user