AnishaG0201 commited on
Commit
5cee749
1 Parent(s): 6ff1a5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +79 -0
app.py CHANGED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ st.set_page_config(layout="wide")
3
+
4
+
5
+
6
+ def main():
7
+ math_topics = {
8
+ "Elementary School Level": ["Basic Arithmetic", "Place Value", "Fraction", "Decimals", "Geomerty"],
9
+ "Middle School Level": ["Algebra", "Ratio and Proportion", "Percentages", "Geometry", "Integers and Rational Numbers"],
10
+ "High School Level": ["Algebra II", "Trigonometry", "Pre-Calculus", "Calculus", "Statistics and Probability"]
11
+ }
12
+
13
+ st.header("Select AI:")
14
+ model = st.radio("Model", [ "Gemini","Open AI",])
15
+ st.write("Selected option:", model)
16
+
17
+ # Page configuration
18
+ st.set_page_config(page_title="Generate Math Quizzes",
19
+ page_icon="🧮",
20
+ layout="centered",
21
+ initial_sidebar_state="collapsed")
22
+
23
+ # Header and description
24
+ st.title("Generate Math Quizzes 🧮")
25
+ st.text("Choose the difficulty level and topic for your math quizzes.")
26
+
27
+ # User input for quiz generation
28
+ ## Layout in columns
29
+ col1, col2, col3 = st.columns([1, 1, 1])
30
+
31
+ with col1:
32
+ selected_topic_level = st.selectbox('Select Topic Level', list(math_topics.keys()))
33
+
34
+ with col2:
35
+ selected_topic = st.selectbox('Select Topic', math_topics[selected_topic_level])
36
+
37
+ with col3:
38
+ num_quizzes = st.slider('Number Quizzes', min_value=1, max_value= 5, value=1)
39
+
40
+ submit = st.button('Generate Quizzes')
41
+
42
+
43
+ # Final Response
44
+ if submit:
45
+ with st.spinner("Generating Quizzes..."):
46
+ response = GetLLMResponse(selected_topic_level, selected_topic, num_quizzes)
47
+ st.success("Quizzes Generated!")
48
+
49
+ # Display questions and answers in a table
50
+ if response:
51
+ st.subheader("Quiz Questions and Answers:")
52
+ # Prepare data for the table
53
+ col1, col2 = st.columns(2)
54
+ with col1:
55
+ st.subheader("Questions")
56
+ questions = response.get('questions')
57
+ st.write(questions)
58
+
59
+ with col2:
60
+ st.subheader("Answers")
61
+ answers = response.get('answer')
62
+ st.write(answers)
63
+
64
+ else:
65
+ st.warning("No Quiz Questions and Answers")
66
+
67
+ else:
68
+ st.warning("Click the 'Generate Quizzes' button to create quizzes.")
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+ if __name__ == "__main__":
79
+ main()