Upload folder using huggingface_hub
Browse files
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 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
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(
|