Spaces:
Sleeping
Sleeping
mohammed3536
commited on
Commit
•
c49c76a
1
Parent(s):
214aabb
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ import streamlit as st
|
|
5 |
from openai import OpenAI
|
6 |
from dotenv import load_dotenv
|
7 |
import os
|
8 |
-
from openai import ChatCompletion
|
9 |
|
10 |
# Download NLTK data (if not already downloaded)
|
11 |
nltk.download('punkt')
|
@@ -38,6 +37,7 @@ def generate_mcqs_on_topic(text, topic, num_mcqs=5):
|
|
38 |
return mcqs
|
39 |
|
40 |
def generate_question_with_chatgpt(context, topic):
|
|
|
41 |
# Initializing the default value
|
42 |
generated_question = {
|
43 |
'content': "Unable to generate a question..",
|
@@ -55,7 +55,7 @@ def generate_question_with_chatgpt(context, topic):
|
|
55 |
],
|
56 |
}
|
57 |
|
58 |
-
response =
|
59 |
result = response.json()
|
60 |
|
61 |
print("API Response:", result) # Add this line for debugging
|
|
|
5 |
from openai import OpenAI
|
6 |
from dotenv import load_dotenv
|
7 |
import os
|
|
|
8 |
|
9 |
# Download NLTK data (if not already downloaded)
|
10 |
nltk.download('punkt')
|
|
|
37 |
return mcqs
|
38 |
|
39 |
def generate_question_with_chatgpt(context, topic):
|
40 |
+
client=OpenAI()
|
41 |
# Initializing the default value
|
42 |
generated_question = {
|
43 |
'content': "Unable to generate a question..",
|
|
|
55 |
],
|
56 |
}
|
57 |
|
58 |
+
response = client.chat.completions.create(data)
|
59 |
result = response.json()
|
60 |
|
61 |
print("API Response:", result) # Add this line for debugging
|