Spaces:
Sleeping
Sleeping
mohammed3536
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -59,8 +59,8 @@ def generate_question_with_chatgpt(context):
|
|
59 |
response = requests.post(CHATGPT_API_ENDPOINT, json=data, headers=headers)
|
60 |
result = response.json()
|
61 |
|
62 |
-
if 'choices' in result:
|
63 |
-
# Extract the generated question from the response
|
64 |
generated_question = {
|
65 |
'content': result["choices"][0]["message"]["content"],
|
66 |
'options': result["choices"][0]["message"].get("options", []),
|
@@ -98,3 +98,4 @@ if __name__ == "__main__":
|
|
98 |
main()
|
99 |
|
100 |
|
|
|
|
59 |
response = requests.post(CHATGPT_API_ENDPOINT, json=data, headers=headers)
|
60 |
result = response.json()
|
61 |
|
62 |
+
if 'choices' in result:
|
63 |
+
# Extract the generated question, options, and correct answer from the response
|
64 |
generated_question = {
|
65 |
'content': result["choices"][0]["message"]["content"],
|
66 |
'options': result["choices"][0]["message"].get("options", []),
|
|
|
98 |
main()
|
99 |
|
100 |
|
101 |
+
|