mohammed3536 commited on
Commit
75cd89e
·
verified ·
1 Parent(s): d660a3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -77,18 +77,20 @@ def generate_question_with_chatgpt(context, topic):
77
  choice = result['choices'][0]
78
  if 'message' in choice and isinstance(choice['message'], dict):
79
  message = choice['message']
80
- content = message.get('content', "Unable to generate a question..")
81
- options = message.get('options', [])
82
- correct_answer = message.get('correct_answer', "Unknown")
 
83
 
84
- generated_question['content'] = content
85
- generated_question['options'] = options
86
- generated_question['correct_answer'] = correct_answer
87
 
88
  return generated_question
89
 
90
 
91
 
 
92
  def main():
93
  # Title of the Application
94
  st.header("🤖CB Quiz Generator🧠", divider='rainbow')
 
77
  choice = result['choices'][0]
78
  if 'message' in choice and isinstance(choice['message'], dict):
79
  message = choice['message']
80
+ if 'content' in message:
81
+ content = message['content']
82
+ options = message.get('options', [])
83
+ correct_answer = message.get('correct_answer', "Unknown")
84
 
85
+ generated_question['content'] = content
86
+ generated_question['options'] = options
87
+ generated_question['correct_answer'] = correct_answer
88
 
89
  return generated_question
90
 
91
 
92
 
93
+
94
  def main():
95
  # Title of the Application
96
  st.header("🤖CB Quiz Generator🧠", divider='rainbow')