Update app.py
Browse files
app.py
CHANGED
|
@@ -24,13 +24,13 @@ def generate_speech(input_text):
|
|
| 24 |
|
| 25 |
# Extract generated text from API response
|
| 26 |
message_content = completion.choices[0].message.content
|
| 27 |
-
text_in_quotes = re.findall(r'"([^"]*)"', message_content)
|
| 28 |
|
| 29 |
# Make sure that text_in_quotes is a single string (concatenate if required)
|
| 30 |
text_to_speech = " ".join(text_in_quotes) if text_in_quotes else "No quotes found in the message."
|
| 31 |
|
| 32 |
# ElevenLabs TTS API settings and request
|
| 33 |
-
url = "https://api.elevenlabs.io/v1/text-to-speech/eIH76iW9yjOWnOKIkd6y/
|
| 34 |
headers = {
|
| 35 |
"Authorization": f"Bearer {elevenlabs_api_key}",
|
| 36 |
"Content-Type": "application/json"
|
|
|
|
| 24 |
|
| 25 |
# Extract generated text from API response
|
| 26 |
message_content = completion.choices[0].message.content
|
| 27 |
+
text_in_quotes = str(re.findall(r'"([^"]*)"', message_content))
|
| 28 |
|
| 29 |
# Make sure that text_in_quotes is a single string (concatenate if required)
|
| 30 |
text_to_speech = " ".join(text_in_quotes) if text_in_quotes else "No quotes found in the message."
|
| 31 |
|
| 32 |
# ElevenLabs TTS API settings and request
|
| 33 |
+
url = "https://api.elevenlabs.io/v1/text-to-speech/eIH76iW9yjOWnOKIkd6y/stream"
|
| 34 |
headers = {
|
| 35 |
"Authorization": f"Bearer {elevenlabs_api_key}",
|
| 36 |
"Content-Type": "application/json"
|