mohammed3536 commited on
Commit
dbbe96f
·
verified ·
1 Parent(s): 325487d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -43,6 +43,7 @@ def generate_question_with_chatgpt(context):
43
  }
44
 
45
  generated_question = []
 
46
  data = {
47
  "model": "gpt-3.5-turbo",
48
  "messages": [
@@ -54,6 +55,10 @@ def generate_question_with_chatgpt(context):
54
  response = requests.post(CHATGPT_API_ENDPOINT, json=data, headers=headers)
55
  result = response.json()
56
 
 
 
 
 
57
  # Extract the generated question from the response
58
  generated_question = result["choices"][0]["message"]["content"]
59
 
 
43
  }
44
 
45
  generated_question = []
46
+
47
  data = {
48
  "model": "gpt-3.5-turbo",
49
  "messages": [
 
55
  response = requests.post(CHATGPT_API_ENDPOINT, json=data, headers=headers)
56
  result = response.json()
57
 
58
+ if 'choices' in result:
59
+
60
+
61
+
62
  # Extract the generated question from the response
63
  generated_question = result["choices"][0]["message"]["content"]
64