malek-messaoudii commited on
Commit
77e2cd7
·
1 Parent(s): 9c9026a

fix: Resolve merge conflicts in tts_service.py, ensuring proper integration of gTTS for text-to-speech functionality and maintaining MP3 format support.

Browse files
Files changed (1) hide show
  1. services/tts_service.py +0 -6
services/tts_service.py CHANGED
@@ -1,10 +1,7 @@
1
  import uuid
2
  from pathlib import Path
3
  from config import GROQ_TTS_API_KEY, GROQ_TTS_MODEL
4
- <<<<<<< Updated upstream
5
- =======
6
  from gtts import gTTS
7
- >>>>>>> Stashed changes
8
 
9
  def text_to_speech(
10
  text: str,
@@ -15,7 +12,6 @@ def text_to_speech(
15
  Convert text to speech using gTTS (Google Translate, free).
16
  Only MP3 is supported.
17
  """
18
- <<<<<<< Updated upstream
19
  if not GROQ_TTS_API_KEY:
20
  raise RuntimeError("GROQ_TTS_API_KEY is not set in config")
21
 
@@ -36,14 +32,12 @@ def text_to_speech(
36
  "response_format": fmt
37
  }
38
 
39
- =======
40
  if not text or not text.strip():
41
  raise ValueError("Text cannot be empty")
42
 
43
  if fmt != "mp3":
44
  raise ValueError("Only MP3 format is supported by the free TTS backend")
45
 
46
- >>>>>>> Stashed changes
47
  try:
48
  temp_dir = Path("temp_audio")
49
  temp_dir.mkdir(exist_ok=True)
 
1
  import uuid
2
  from pathlib import Path
3
  from config import GROQ_TTS_API_KEY, GROQ_TTS_MODEL
 
 
4
  from gtts import gTTS
 
5
 
6
  def text_to_speech(
7
  text: str,
 
12
  Convert text to speech using gTTS (Google Translate, free).
13
  Only MP3 is supported.
14
  """
 
15
  if not GROQ_TTS_API_KEY:
16
  raise RuntimeError("GROQ_TTS_API_KEY is not set in config")
17
 
 
32
  "response_format": fmt
33
  }
34
 
 
35
  if not text or not text.strip():
36
  raise ValueError("Text cannot be empty")
37
 
38
  if fmt != "mp3":
39
  raise ValueError("Only MP3 format is supported by the free TTS backend")
40
 
 
41
  try:
42
  temp_dir = Path("temp_audio")
43
  temp_dir.mkdir(exist_ok=True)