Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
81 |
-
|
82 |
-
|
|
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
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')
|