Spaces:
Runtime error
Runtime error
Vipul Swarup commited on
Commit ·
e0e56e1
1
Parent(s): 5c2dde2
further optimization
Browse files
app.py
CHANGED
|
@@ -77,6 +77,9 @@ def load_answer(question):
|
|
| 77 |
passage_and_research = chat(st.session_state.sessionMessages)
|
| 78 |
st.session_state.sessionMessages.append(AIMessage(content=passage_and_research.content))
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
# Based on the above generated passage and research topic, we will now generate 3 FRQs and their grading rubrics
|
| 81 |
frqPrompt='Generate 3 questions based on the previously discussed common core standard, and the above generated passage. The answers should be available either in the above passage, or the student should be able to find them with easy web research. Good questions have: introduction, context, and open-ended question. Remember, the student is in grade: '+chatResponseDict['grade-level']
|
| 82 |
frqPrompt+='Generate a rubric for evaluating the student responses for the above questions. Return the result in JSON format. E.g. { "rubric":[{"question":"..text of the question", "rubric":".. text of the rubric"}] etc.'
|
|
@@ -86,6 +89,9 @@ def load_answer(question):
|
|
| 86 |
question_and_rubric = chat(st.session_state.sessionMessages)
|
| 87 |
st.session_state.sessionMessages.append(AIMessage(content=question_and_rubric.content))
|
| 88 |
|
|
|
|
|
|
|
|
|
|
| 89 |
## Do the QC Step
|
| 90 |
qcPrompt='For the JSON generated in the previous step, please evaluate for each question and rubric:\
|
| 91 |
- Does the FRQ have an introduction, context, and an open-ended question\
|
|
@@ -103,9 +109,7 @@ def load_answer(question):
|
|
| 103 |
st.session_state.sessionMessages.append(HumanMessage(content=qcPrompt))
|
| 104 |
qcResponseJson = json.loads(chat(st.session_state.sessionMessages).content)
|
| 105 |
|
| 106 |
-
## Write
|
| 107 |
-
st.write(passage_and_research.content)
|
| 108 |
-
st.write(question_and_rubric.content)
|
| 109 |
st.write(qcResponseJson)
|
| 110 |
|
| 111 |
## Qc Response doesn't need to into the session state
|
|
|
|
| 77 |
passage_and_research = chat(st.session_state.sessionMessages)
|
| 78 |
st.session_state.sessionMessages.append(AIMessage(content=passage_and_research.content))
|
| 79 |
|
| 80 |
+
# Print passage
|
| 81 |
+
st.write(passage_and_research.content)
|
| 82 |
+
|
| 83 |
# Based on the above generated passage and research topic, we will now generate 3 FRQs and their grading rubrics
|
| 84 |
frqPrompt='Generate 3 questions based on the previously discussed common core standard, and the above generated passage. The answers should be available either in the above passage, or the student should be able to find them with easy web research. Good questions have: introduction, context, and open-ended question. Remember, the student is in grade: '+chatResponseDict['grade-level']
|
| 85 |
frqPrompt+='Generate a rubric for evaluating the student responses for the above questions. Return the result in JSON format. E.g. { "rubric":[{"question":"..text of the question", "rubric":".. text of the rubric"}] etc.'
|
|
|
|
| 89 |
question_and_rubric = chat(st.session_state.sessionMessages)
|
| 90 |
st.session_state.sessionMessages.append(AIMessage(content=question_and_rubric.content))
|
| 91 |
|
| 92 |
+
# Print rubric & questions
|
| 93 |
+
st.write(question_and_rubric.content)
|
| 94 |
+
|
| 95 |
## Do the QC Step
|
| 96 |
qcPrompt='For the JSON generated in the previous step, please evaluate for each question and rubric:\
|
| 97 |
- Does the FRQ have an introduction, context, and an open-ended question\
|
|
|
|
| 109 |
st.session_state.sessionMessages.append(HumanMessage(content=qcPrompt))
|
| 110 |
qcResponseJson = json.loads(chat(st.session_state.sessionMessages).content)
|
| 111 |
|
| 112 |
+
## Write QC results
|
|
|
|
|
|
|
| 113 |
st.write(qcResponseJson)
|
| 114 |
|
| 115 |
## Qc Response doesn't need to into the session state
|