Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
import PyPDF2
|
2 |
import nltk
|
3 |
-
from nltk.tokenize import sent_tokenize
|
4 |
import random
|
5 |
import streamlit as st
|
6 |
from langchain_openai import OpenAI
|
7 |
|
8 |
# Download NLTK data (if not already downloaded)
|
9 |
nltk.download('punkt')
|
10 |
-
nltk.download('averaged_perceptron_tagger')
|
11 |
|
12 |
# LangChain OpenAI wrapper
|
13 |
openai = OpenAI(api_key="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")
|
@@ -50,9 +48,7 @@ def generate_question_with_chatgpt(context):
|
|
50 |
],
|
51 |
}
|
52 |
|
53 |
-
|
54 |
-
response = openai.chatcompletion.create(data)
|
55 |
-
|
56 |
result = response.json()
|
57 |
|
58 |
print("API Response:", result) # Add this line for debugging
|
@@ -69,8 +65,6 @@ def generate_question_with_chatgpt(context):
|
|
69 |
|
70 |
return generated_question
|
71 |
|
72 |
-
|
73 |
-
|
74 |
def main():
|
75 |
# Title of the Application
|
76 |
st.header("🤖CB Quiz Generator🧠", divider='rainbow')
|
@@ -100,6 +94,7 @@ if __name__ == "__main__":
|
|
100 |
main()
|
101 |
|
102 |
|
|
|
103 |
|
104 |
|
105 |
|
|
|
1 |
import PyPDF2
|
2 |
import nltk
|
|
|
3 |
import random
|
4 |
import streamlit as st
|
5 |
from langchain_openai import OpenAI
|
6 |
|
7 |
# Download NLTK data (if not already downloaded)
|
8 |
nltk.download('punkt')
|
|
|
9 |
|
10 |
# LangChain OpenAI wrapper
|
11 |
openai = OpenAI(api_key="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")
|
|
|
48 |
],
|
49 |
}
|
50 |
|
51 |
+
response = openai.ChatCompletion.create(data)
|
|
|
|
|
52 |
result = response.json()
|
53 |
|
54 |
print("API Response:", result) # Add this line for debugging
|
|
|
65 |
|
66 |
return generated_question
|
67 |
|
|
|
|
|
68 |
def main():
|
69 |
# Title of the Application
|
70 |
st.header("🤖CB Quiz Generator🧠", divider='rainbow')
|
|
|
94 |
main()
|
95 |
|
96 |
|
97 |
+
|
98 |
|
99 |
|
100 |
|