Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > Python
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-08-2025
juank1971 juank1971 is offline
Miembro
 
Registrado: feb 2008
Posts: 241
Poder: 19
juank1971 Va por buen camino
python4delphi

Hola tengo este script en python :

Código:
# voz_module.py
import speech_recognition as sr
import json

def reconocer_voz():
    """
    Retorna un JSON con:
    { "texto": "hola", "error": "" }
    """
    r = sr.Recognizer()
    r.pause_threshold = 2.5

    try:
        with sr.Microphone() as source:
            audio = r.listen(source, timeout=10, phrase_time_limit=20)
        texto = r.recognize_google(audio, language="es-ES")
        return json.dumps({"texto": texto, "error": ""})
    except sr.WaitTimeoutError:
        return json.dumps({"texto": "", "error": "NO_VOZ"})
    except sr.UnknownValueError:
        return json.dumps({"texto": "", "error": "NO_ENTENDIDO"})
    except sr.RequestError:
        return json.dumps({"texto": "", "error": "ERROR_RED"})
    except Exception as e:
        return json.dumps({"texto": "", "error": "EXCEPCION"})

# Para pruebas locales
if __name__ == "__main__":
    print(reconocer_voz())
quisiera ejecutralo en python4delphi desde delphi 12.3 pero que cuando distribulla la aplicacion .exe el cliente no tenga que tener instalado el python esto es posible ?

Última edición por Casimiro Noteví fecha: 13-08-2025 a las 09:39:34.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
python4delphi roberto_valverde Varios 2 08-06-2024 02:49:14


La franja horaria es GMT +2. Ahora son las 11:25:40.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi