siddhartharya
commited on
Commit
•
8aaed31
1
Parent(s):
33b5903
Update utils.py
Browse files
utils.py
CHANGED
@@ -12,7 +12,7 @@ groq_client = Groq(api_key=os.environ["GROQ_API_KEY"])
|
|
12 |
tokenizer = tiktoken.get_encoding("cl100k_base")
|
13 |
|
14 |
class DialogueItem(BaseModel):
|
15 |
-
speaker: Literal["
|
16 |
text: str
|
17 |
|
18 |
class Dialogue(BaseModel):
|
@@ -59,7 +59,7 @@ def generate_script(system_prompt: str, input_text: str, tone: str):
|
|
59 |
return dialogue
|
60 |
|
61 |
def generate_audio(text: str, speaker: str) -> str:
|
62 |
-
tts = gTTS(text=text, lang='en', tld='com'
|
63 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as temp_audio:
|
64 |
tts.save(temp_audio.name)
|
65 |
return temp_audio.name
|
|
|
12 |
tokenizer = tiktoken.get_encoding("cl100k_base")
|
13 |
|
14 |
class DialogueItem(BaseModel):
|
15 |
+
speaker: Literal["Maria", "Sarah"]
|
16 |
text: str
|
17 |
|
18 |
class Dialogue(BaseModel):
|
|
|
59 |
return dialogue
|
60 |
|
61 |
def generate_audio(text: str, speaker: str) -> str:
|
62 |
+
tts = gTTS(text=text, lang='en', tld='com')
|
63 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as temp_audio:
|
64 |
tts.save(temp_audio.name)
|
65 |
return temp_audio.name
|