Spaces:
Sleeping
Sleeping
Update function.py
Browse files- function.py +3 -4
function.py
CHANGED
@@ -5,7 +5,6 @@ import streamlit as st
|
|
5 |
|
6 |
|
7 |
def get_answers(questions,model):
|
8 |
-
st.write("running get answers function answering following questions",questions)
|
9 |
|
10 |
|
11 |
answer_prompt = (f"I want you to become a teacher answer this specific Question: {questions}. You should gave me a straightforward and consise explanation and answer to each one of them")
|
@@ -30,7 +29,7 @@ def get_answers(questions,model):
|
|
30 |
def GetLLMResponse(selected_topic_level, selected_topic,num_quizzes, model):
|
31 |
question_prompt = (f'I want you to just generate question with this specification: Generate a {selected_topic_level} math quiz on the topic of {selected_topic}. Generate only {num_quizzes} questions not more and without providing answers.')
|
32 |
|
33 |
-
|
34 |
if model == "Open AI":
|
35 |
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
36 |
questions = llm(question_prompt)
|
@@ -43,9 +42,9 @@ def GetLLMResponse(selected_topic_level, selected_topic,num_quizzes, model):
|
|
43 |
# return questions.content
|
44 |
|
45 |
|
46 |
-
|
47 |
answers = get_answers(questions,model)
|
48 |
|
49 |
-
|
50 |
return(questions,answers)
|
51 |
|
|
|
5 |
|
6 |
|
7 |
def get_answers(questions,model):
|
|
|
8 |
|
9 |
|
10 |
answer_prompt = (f"I want you to become a teacher answer this specific Question: {questions}. You should gave me a straightforward and consise explanation and answer to each one of them")
|
|
|
29 |
def GetLLMResponse(selected_topic_level, selected_topic,num_quizzes, model):
|
30 |
question_prompt = (f'I want you to just generate question with this specification: Generate a {selected_topic_level} math quiz on the topic of {selected_topic}. Generate only {num_quizzes} questions not more and without providing answers.')
|
31 |
|
32 |
+
|
33 |
if model == "Open AI":
|
34 |
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
35 |
questions = llm(question_prompt)
|
|
|
42 |
# return questions.content
|
43 |
|
44 |
|
45 |
+
|
46 |
answers = get_answers(questions,model)
|
47 |
|
48 |
+
|
49 |
return(questions,answers)
|
50 |
|