HassanDataSci commited on
Commit
9816b35
·
verified ·
1 Parent(s): 87f9b08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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.chat_completions_v1(
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.choices[0]['message']['content']
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):