Update app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,14 @@ elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY")
|
|
| 13 |
# Define the function that generates the speech
|
| 14 |
def generate_speech(input_text):
|
| 15 |
# Build completion with OpenAI (ChatGPT part)
|
| 16 |
-
completion = client.chat.completions.create(
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
)
|
| 24 |
|
| 25 |
# Extract generated text from API response
|
| 26 |
message_content = completion.choices[0].message.content # Access the message content attribute
|
|
|
|
| 13 |
# Define the function that generates the speech
|
| 14 |
def generate_speech(input_text):
|
| 15 |
# Build completion with OpenAI (ChatGPT part)
|
| 16 |
+
completion = client.chat.completions.create(
|
| 17 |
+
model="gpt-3.5-turbo-1106",
|
| 18 |
+
messages=[
|
| 19 |
+
{"role": "system",
|
| 20 |
+
"content": "You are Johnny Carson, interviewing a guest (the user) on the Tonight Show in 1978. While chatting with the user, you make occasional jokes using Johnny Carson characteristic humor. Your knowledge of the world ends in 1978."},
|
| 21 |
+
{"role": "user", "content": input_text}
|
| 22 |
+
]
|
| 23 |
+
)
|
| 24 |
|
| 25 |
# Extract generated text from API response
|
| 26 |
message_content = completion.choices[0].message.content # Access the message content attribute
|