Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ def generate_response(prompt):
|
|
15 |
trump_prompt = f"As if you were Donald Trump, respond to the following: {prompt}"
|
16 |
|
17 |
# Call OpenAI API to generate response using the updated format
|
18 |
-
response = openai.
|
19 |
model="gpt-3.5-turbo", # Or "gpt-4" if available in your account
|
20 |
messages=[
|
21 |
{"role": "system", "content": "You are to respond as Donald Trump would."},
|
@@ -24,7 +24,7 @@ def generate_response(prompt):
|
|
24 |
max_tokens=100,
|
25 |
temperature=0.8
|
26 |
)
|
27 |
-
return response
|
28 |
|
29 |
# Function to convert text to audio using gTTS
|
30 |
def generate_audio(text):
|
|
|
15 |
trump_prompt = f"As if you were Donald Trump, respond to the following: {prompt}"
|
16 |
|
17 |
# Call OpenAI API to generate response using the updated format
|
18 |
+
response = openai.ChatCompletion.create(
|
19 |
model="gpt-3.5-turbo", # Or "gpt-4" if available in your account
|
20 |
messages=[
|
21 |
{"role": "system", "content": "You are to respond as Donald Trump would."},
|
|
|
24 |
max_tokens=100,
|
25 |
temperature=0.8
|
26 |
)
|
27 |
+
return response['choices'][0]['message']['content']
|
28 |
|
29 |
# Function to convert text to audio using gTTS
|
30 |
def generate_audio(text):
|