Skip to content

Commit

Permalink
support files in make transcribe
Browse files Browse the repository at this point in the history
  • Loading branch information
ajar98 committed Jul 5, 2024
1 parent c580d13 commit 7a54f5a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions playground/streaming/transcriber/transcribe.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from vocode.streaming.input_device.file_input_device import FileInputDevice
from vocode.streaming.input_device.microphone_input import MicrophoneInput
from vocode.streaming.models.transcriber import DeepgramTranscriberConfig, Transcription
from vocode.streaming.transcriber.base_transcriber import BaseTranscriber
Expand All @@ -19,19 +20,20 @@ async def print_output(transcriber: BaseTranscriber):
print(transcription)

async def listen():
microphone_input = MicrophoneInput.from_default_device()
# microphone_input = MicrophoneInput.from_default_device()
input_device = FileInputDevice(file_path="spacewalk.wav")

# replace with the transcriber you want to test
transcriber = DeepgramTranscriber(
DeepgramTranscriberConfig.from_input_device(
microphone_input, endpointing_config=DeepgramEndpointingConfig()
input_device, endpointing_config=DeepgramEndpointingConfig()
)
)
transcriber.start()
asyncio.create_task(print_output(transcriber))
print("Start speaking...press Ctrl+C to end. ")
while True:
chunk = await microphone_input.get_audio()
chunk = await input_device.get_audio()
transcriber.send_audio(chunk)

asyncio.run(listen())

0 comments on commit 7a54f5a

Please sign in to comment.