freddyaboulton HF staff commited on
Commit
9263d90
·
verified ·
1 Parent(s): 5dbb5d9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -10,7 +10,6 @@ from fastrtc import (
10
  AdditionalOutputs,
11
  ReplyOnPause,
12
  Stream,
13
- WebRTCError,
14
  audio_to_bytes,
15
  get_twilio_turn_credentials,
16
  )
@@ -26,15 +25,12 @@ groq_client = AsyncClient()
26
 
27
 
28
  async def transcribe(audio: tuple[int, np.ndarray]):
29
- try:
30
- transcript = await groq_client.audio.transcriptions.create(
31
- file=("audio-file.mp3", audio_to_bytes(audio)),
32
- model="whisper-large-v3-turbo",
33
- response_format="verbose_json",
34
- )
35
- yield AdditionalOutputs(transcript.text)
36
- except Exception as e:
37
- raise WebRTCError(str(e))
38
 
39
 
40
  stream = Stream(
 
10
  AdditionalOutputs,
11
  ReplyOnPause,
12
  Stream,
 
13
  audio_to_bytes,
14
  get_twilio_turn_credentials,
15
  )
 
25
 
26
 
27
  async def transcribe(audio: tuple[int, np.ndarray]):
28
+ transcript = await groq_client.audio.transcriptions.create(
29
+ file=("audio-file.mp3", audio_to_bytes(audio)),
30
+ model="whisper-large-v3-turbo",
31
+ response_format="verbose_json",
32
+ )
33
+ yield AdditionalOutputs(transcript.text)
 
 
 
34
 
35
 
36
  stream = Stream(