Skip to main content

The Huggingface wav2vec ASR incremental modules for the retico framework

Project description

retico-wav2vecasr

Local wav2vec ASR Module for ReTiCo

Example

import retico_core
from retico_wav2vecasr import *
from retico_wav2vecasr.wav2vecasr import Wav2VecASRModule

microphone = retico_core.audio.MicrophoneModule(960, 48000)
asr = Wav2VecASRModule("de")

msg = []


def callback(update_msg):
    global msg
    for x, ut in update_msg:
        if ut == retico_core.UpdateType.ADD:
            msg.append(x)
        if ut == retico_core.UpdateType.REVOKE:
            if x not in msg:
                print("ERROR", x, msg)
            msg.remove(x)
    txt = ""
    committed = False
    for x in msg:
        txt += x.text
        committed = committed or x.committed
    print(f"                                                ", end="\r")
    print(f"{txt}", end="\r")
    if committed:
        msg = []
        print("")


m3 = debug.CallbackModule(callback=callback)

microphone.subscribe(asr)
asr.subscribe(m3)

retico_core.network.run(asr)

print("Running the stuff")
input()

retico_core.network.stop(asr)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retico-wav2vecasr-0.1.0.tar.gz (8.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page