Skip to content

How to process text only mode? #359

@david-ng-hk

Description

@david-ng-hk

I play around with your code in huggingface talk-to-gemini

I am using AsyncStreamHandler
I remove below code
const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); stream.getTracks().forEach(track => peerConnection.addTrack(track, stream)); if (!audioContext || audioContext.state === 'closed') { audioContext = new AudioContext(); } if (source_input) { try { source_input.disconnect(); } catch (e) { console.warn("Error disconnecting previous input source:", e); } source_input = null; } source_input = audioContext.createMediaStreamSource(stream); analyser_input = audioContext.createAnalyser(); source_input.connect(analyser_input); analyser_input.fftSize = 64; dataArray_input = new Uint8Array(analyser_input.frequencyBinCount); updateAudioLevel();
from
https://huggingface.co/spaces/fastrtc/talk-to-gemini/blob/main/index.html

and found I can not send over the text.

do some research, and from
https://github.com/gradio-app/fastrtc/blob/main/docs/reference/stream_handlers.md?plain=1
it has audio and video receive() call back function, but there is no text call back function.

is there any text only sample with AsyncStreamHandler ?
thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions