healthchat / modules /audio_processing.py
Prince012's picture
multimodal ai chatbot
03d8f07
import os
from groq import Groq
from dotenv import load_dotenv
load_dotenv()
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
def transcribe_audio(audio_filepath, stt_model='whisper-large-v3'):
client = Groq(api_key=GROQ_API_KEY)
with open(audio_filepath, "rb") as audio_file:
transcription = client.audio.transcriptions.create(
model=stt_model,
file=audio_file,
language="en"
)
return transcription.text