Not-Adam commited on
Commit
626f015
·
verified ·
1 Parent(s): a682438

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -242,7 +242,7 @@ def send_request_to_openai(prompt: str) -> Optional[Dict[str, Any]]:
242
  ]
243
 
244
  try:
245
- response = client.chat.completions.create(
246
  model="gpt-3.5-turbo-16k",
247
  messages=messages,
248
  temperature=1.0,
@@ -252,7 +252,7 @@ def send_request_to_openai(prompt: str) -> Optional[Dict[str, Any]]:
252
  presence_penalty=0.0
253
  )
254
 
255
- json_string = response['choices'][0]['message']['content']
256
  parsed_response = json.loads(json_string)
257
 
258
  print(f"English name: {parsed_response['name_en']}")
 
242
  ]
243
 
244
  try:
245
+ openai_response = client.chat.completions.create(
246
  model="gpt-3.5-turbo-16k",
247
  messages=messages,
248
  temperature=1.0,
 
252
  presence_penalty=0.0
253
  )
254
 
255
+ json_string = openai_response.choices[0].message.content
256
  parsed_response = json.loads(json_string)
257
 
258
  print(f"English name: {parsed_response['name_en']}")