Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,9 @@ from nltk.tokenize import sent_tokenize
|
|
4 |
import random
|
5 |
import requests
|
6 |
import streamlit as st
|
|
|
|
|
|
|
7 |
|
8 |
# Download NLTK data (if not already downloaded)
|
9 |
nltk.download('punkt')
|
@@ -36,6 +39,9 @@ def generate_mcqs_on_topic(text, topic, num_mcqs=5):
|
|
36 |
return mcqs
|
37 |
|
38 |
def generate_question_with_chatgpt(context):
|
|
|
|
|
|
|
39 |
headers = {
|
40 |
"Content-Type": "application/json",
|
41 |
"Authorization": f"Bearer {OPENAI_API_KEY}",
|
|
|
4 |
import random
|
5 |
import requests
|
6 |
import streamlit as st
|
7 |
+
from langchain_openai import OpenAI, OpenAIEmbeddings
|
8 |
+
from langchain.prompts import PromptTemplate
|
9 |
+
from langchain.chains import LLMChain
|
10 |
|
11 |
# Download NLTK data (if not already downloaded)
|
12 |
nltk.download('punkt')
|
|
|
39 |
return mcqs
|
40 |
|
41 |
def generate_question_with_chatgpt(context):
|
42 |
+
|
43 |
+
llm = OpenAI(temperature=0.4)
|
44 |
+
|
45 |
headers = {
|
46 |
"Content-Type": "application/json",
|
47 |
"Authorization": f"Bearer {OPENAI_API_KEY}",
|