informatica:speech_to_text
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
informatica:speech_to_text [2023/03/21 14:28] – jose | informatica:speech_to_text [2023/03/21 16:31] – jose | ||
---|---|---|---|
Line 48: | Line 48: | ||
</ | </ | ||
+ | Se envía un audio con este comando y te devuelve el texto: | ||
+ | curl -X POST -F ' | ||
+ | |||
+ | ====== Servicio de Google ====== | ||
+ | < | ||
+ | import speech_recognition as sr | ||
+ | import time | ||
+ | |||
+ | # Creamos un objeto Recognizer | ||
+ | r = sr.Recognizer() | ||
+ | |||
+ | # Abrimos el archivo de audio y lo pasamos al objeto AudioFile | ||
+ | with sr.AudioFile(' | ||
+ | # Leemos el audio del archivo | ||
+ | audio = r.record(source) | ||
+ | |||
+ | # Convertimos el audio a texto | ||
+ | text = r.recognize_google(audio, | ||
+ | |||
+ | # Generamos un nombre de archivo único para el texto | ||
+ | filename = ' | ||
+ | |||
+ | # Guardamos el texto en un archivo de texto | ||
+ | with open(filename, | ||
+ | f.write(text) | ||
+ | </ |
informatica/speech_to_text.txt · Last modified: 2023/04/14 08:31 by jose