malek-messaoudii
Update stt_service.py
209f7bb
raw
history blame
430 Bytes
# stt_service.py
import requests
from config import GROQ_API_KEY, GROQ_STT_MODEL
def speech_to_text(audio_file_path: str) -> str:
headers = {"Authorization": f"Bearer {GROQ_API_KEY}"}
files = {"file": open(audio_file_path, "rb")}
response = requests.post(
f"https://api.groq.ai/v1/models/{GROQ_STT_MODEL}/predict",
headers=headers,
files=files
)
return response.json().get("text", "")