whisper.cpp en tiempo real con tiny
This commit is contained in:
@ -6,8 +6,15 @@ defmodule Recognition_VADWeb.DataChannel do
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
# Parcial
|
||||
def handle_info({:realtime, msg}, socket) do
|
||||
push(socket, "realtime", msg)
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
# Completo
|
||||
def handle_info({:broadcast_audio, msg}, socket) do
|
||||
push(socket, "transcription", Jason.decode!(msg))
|
||||
push(socket, "transcription", msg)
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
@ -15,7 +22,7 @@ defmodule Recognition_VADWeb.DataChannel do
|
||||
def handle_in("audio_chunk", %{"data" => base64_chunk, "sample_rate" => sample_rate}, socket) do
|
||||
case Base.decode64(base64_chunk) do
|
||||
{:ok, binary_audio} ->
|
||||
GenServer.cast(Recognition_VAD.AudioProcessor, {:chunk, binary_audio, sample_rate})
|
||||
Recognition_VAD.WhisperStreamer.push_chunk(binary_audio, sample_rate)
|
||||
{:noreply, socket}
|
||||
|
||||
:error ->
|
||||
|
Reference in New Issue
Block a user