Add question db insert.

This commit is contained in:
Cristiano Ferreira
2023-08-24 21:28:59 +01:00
parent 18bf6d59e0
commit ca6094c3e7
11 changed files with 1257 additions and 62 deletions

View File

@@ -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)