Zeeshan265 commited on
Commit
57c44fc
·
verified ·
1 Parent(s): 7d896b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -251,30 +251,30 @@ def main_interface():
251
  ss.answers = None
252
  ss.feedback = None
253
  ss.mcqs = None
 
 
 
 
 
 
254
 
255
- if ss.tone:
256
- if ss.area == "Select a Subject":
257
- explanation_prompt = f"Provide an explanation on '{ss.subtopic}' related to '{ss.topic}', in a '{ss.tone}' tone, suitable for a '{ss.level}' level learner, strictly in '{ss.language}'. Avoid introductory phrases."
258
- elif ss.area == "Search Manually":
259
- explanation_prompt = f"Explain the topic {ss.topic}' in a '{ss.tone}' manner at the '{ss.level} level strictly in '{ss.language}'.\nDon't add any intro"
260
-
261
- ss.explanation = get_response(explanation_prompt)
262
  st.write(ss.explanation)
263
-
264
- if ss.explanation:
265
- if st.button("Take a test"):
266
- mcq_prompt = f"Generate 5 'SHORT' multiple-choice questions related to the topic '{ss.topic}', strictly at the '{ss.level}' level.\nThe explanation used to explain the topic is:\n '{ss.explanation}'.\nPlease ensure each answer option is on a new line, and do not specify the correct answers."
267
- ss.mcqs = get_response(mcq_prompt)
268
- if ss.mcqs:
269
- st.subheader("Test: Answer the following questions")
270
- st.write(ss.mcqs)
271
- answer = st.text_area("Write your answers here:", height=120, placeholder="Please attempt the answers like:\n1. A\n2. C\n3. B..." )
272
- if st.button("Submit Answers"):
273
- ss.answers = answer
274
- feedback_prompt = f"Evaluate and provide concise feedback in simple words on the following answers to the questions related to '{ss.topic}.'\nThe explanation used to explain the topic is: '{ss.explanation}.'\nThe mcqs are: '{ss.mcqs}.'\nThe answers given by me are: '{ss.answers}.'\nSpecify how many ansers are correct strictly accurately, if the answers are none or irrelevant say something like: 'Kindly give the answers correctly', and if there are some answers missing then specify which ones and request that they be done."
275
- ss.feedback = get_response(feedback_prompt)
276
- st.subheader("Feedback")
277
- st.write(ss.feedback)
278
 
279
 
280
  main_interface()
 
251
  ss.answers = None
252
  ss.feedback = None
253
  ss.mcqs = None
254
+ if ss.area == "Select a Subject":
255
+ explanation_prompt = f"Provide an explanation on '{ss.subtopic}' related to '{ss.topic}', in a '{ss.tone}' tone, suitable for a '{ss.level}' level learner, strictly in '{ss.language}'. Avoid introductory phrases."
256
+ elif ss.area == "Search Manually":
257
+ explanation_prompt = f"Explain the topic {ss.topic}' in a '{ss.tone}' manner at the '{ss.level} level strictly in '{ss.language}'.\nDon't add any intro"
258
+ explanation = get_response(explanation_prompt)
259
+ ss.explanation = explanation
260
 
261
+
262
+ if ss.explanation:
 
 
 
 
 
263
  st.write(ss.explanation)
264
+
265
+ if st.button("Take a test"):
266
+ mcq_prompt = f"Generate 5 'SHORT' multiple-choice questions related to the topic '{ss.topic}', strictly at the '{ss.level}' level.\nThe explanation used to explain the topic is:\n '{ss.explanation}'.\nPlease ensure each answer option is on a new line, and do not specify the correct answers."
267
+ ss.mcqs = get_response(mcq_prompt)
268
+ if ss.mcqs:
269
+ st.subheader("Test: Answer the following questions")
270
+ st.write(ss.mcqs)
271
+ answer = st.text_area("Write your answers here:", height=120, placeholder="Please attempt the answers like:\n1. A\n2. C\n3. B..." )
272
+ if st.button("Submit Answers"):
273
+ ss.answers = answer
274
+ feedback_prompt = f"Evaluate and provide concise feedback in simple words on the following answers to the questions related to '{ss.topic}.'\nThe explanation used to explain the topic is: '{ss.explanation}.'\nThe mcqs are: '{ss.mcqs}.'\nThe answers given by me are: '{ss.answers}.'\nSpecify how many ansers are correct strictly accurately, if the answers are none or irrelevant say something like: 'Kindly give the answers correctly', and if there are some answers missing then specify which ones and request that they be done."
275
+ ss.feedback = get_response(feedback_prompt)
276
+ st.subheader("Feedback")
277
+ st.write(ss.feedback)
 
278
 
279
 
280
  main_interface()