Commit eb176b85 authored by De Silva K.C.C.C's avatar De Silva K.C.C.C

audio to text generation

parent 90ae19a4
...@@ -10,37 +10,6 @@ FOLDER_TEXT = "text_output" ...@@ -10,37 +10,6 @@ FOLDER_TEXT = "text_output"
LANGUAGE = "en-US" LANGUAGE = "en-US"
# print("starting...")
#
# if not os.path.isdir(FOLDER_AUDIO):
# os.mkdir(FOLDER_AUDIO)
#
# if not os.path.isdir(FOLDER_TEXT):
# os.mkdir(FOLDER_TEXT)
#
# paths = [os.path.join(FOLDER_AUDIO, nome) for nome in os.listdir(FOLDER_AUDIO)]
# files = [arq for arq in paths if os.path.isfile(arq)]
# wav_files = [arq for arq in files if arq.lower().endswith(".wav")]
#
# for filename in wav_files:
# r = sr.Recognizer()
# with sr.AudioFile(filename) as source:
# audio = r.record(source)
#
# command = r.recognize_google(audio, language='en-IN', show_all=True)
# print(command)
#
# print("running file {}".format(filename))
#
# filefinal = filename.split("audio_input/")[1].split(".wav")[0]
# filefinal = '{}/{}.txt'.format(FOLDER_TEXT, filefinal)
# with open(filefinal, 'w') as arq:
# arq.write(str(command))
#
# print("create a new file {}".format(filefinal))
#
# print("finish")
def convert_audio_to_text(filename): def convert_audio_to_text(filename):
r = sr.Recognizer() r = sr.Recognizer()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment