Skip to content

Commit

Permalink
support files in make transcribe (#610)
Browse files Browse the repository at this point in the history
* support files in make transcribe

* switch comment
  • Loading branch information
ajar98 authored Jul 5, 2024
1 parent be5f78e commit 9904cd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 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 @@ -20,18 +21,19 @@ async def print_output(transcriber: BaseTranscriber):

async def listen():
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 9904cd6

Please sign in to comment.