Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ st.markdown(
|
|
| 8 |
"""
|
| 9 |
<style>
|
| 10 |
body {
|
| 11 |
-
background-color:
|
| 12 |
color: black;
|
| 13 |
}
|
| 14 |
.sidebar .sidebar-content {
|
|
@@ -25,28 +25,24 @@ menu = st.sidebar.radio("Choose a Role", ["Teacher Section", "Student Section"])
|
|
| 25 |
|
| 26 |
# Data store for simplicity (in-memory, not persistent)
|
| 27 |
data_store = {}
|
| 28 |
-
teacher_paid = False # Payment tracking
|
| 29 |
|
| 30 |
if menu == "Teacher Section":
|
| 31 |
st.title("Teacher Section")
|
| 32 |
|
| 33 |
-
#
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
teacher_paid = True
|
| 37 |
-
st.success("Payment Successful! You can now enter details for 1 year.")
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
paper_cleared = st.number_input("Number of Papers Cleared", min_value=0)
|
| 47 |
|
| 48 |
-
if st.button("Calculate Result"):
|
| 49 |
-
if subjects:
|
| 50 |
marks = list(map(int, subjects.split(",")))
|
| 51 |
total_marks = sum(marks)
|
| 52 |
percentage = total_marks / (len(marks) * 100) * 100
|
|
@@ -72,19 +68,21 @@ if menu == "Teacher Section":
|
|
| 72 |
"father_name": father_name,
|
| 73 |
"percentage": percentage,
|
| 74 |
"grade": grade,
|
|
|
|
|
|
|
| 75 |
}
|
| 76 |
|
| 77 |
# Display Result
|
| 78 |
-
st.write("### Result
|
| 79 |
st.write(f"**School Name:** {school_name}")
|
| 80 |
st.write(f"**Student Name:** {student_name}")
|
| 81 |
st.write(f"**Father's Name:** {father_name}")
|
| 82 |
st.write(f"**Percentage:** {percentage:.2f}%")
|
| 83 |
st.write(f"**Grade:** {grade}")
|
|
|
|
|
|
|
| 84 |
else:
|
| 85 |
-
st.error("Please
|
| 86 |
-
else:
|
| 87 |
-
st.warning("Please complete the payment to access this section.")
|
| 88 |
|
| 89 |
elif menu == "Student Section":
|
| 90 |
st.title("Student Section")
|
|
@@ -103,5 +101,7 @@ elif menu == "Student Section":
|
|
| 103 |
st.write(f"**Father's Name:** {result['father_name']}")
|
| 104 |
st.write(f"**Percentage:** {result['percentage']:.2f}%")
|
| 105 |
st.write(f"**Grade:** {result['grade']}")
|
|
|
|
|
|
|
| 106 |
else:
|
| 107 |
st.error("Result not found. Please check the roll number.")
|
|
|
|
| 8 |
"""
|
| 9 |
<style>
|
| 10 |
body {
|
| 11 |
+
background-color: skyblue;
|
| 12 |
color: black;
|
| 13 |
}
|
| 14 |
.sidebar .sidebar-content {
|
|
|
|
| 25 |
|
| 26 |
# Data store for simplicity (in-memory, not persistent)
|
| 27 |
data_store = {}
|
|
|
|
| 28 |
|
| 29 |
if menu == "Teacher Section":
|
| 30 |
st.title("Teacher Section")
|
| 31 |
|
| 32 |
+
# Input fields for teacher to add multiple students
|
| 33 |
+
school_name = st.text_input("School Name")
|
| 34 |
+
number_of_students = st.number_input("Enter the number of students", min_value=1, max_value=100, step=1)
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
for i in range(int(number_of_students)):
|
| 37 |
+
st.subheader(f"Student {i+1}")
|
| 38 |
+
student_name = st.text_input(f"Student Name {i+1}")
|
| 39 |
+
father_name = st.text_input(f"Father's Name {i+1}")
|
| 40 |
+
roll_no = st.text_input(f"Roll Number {i+1}")
|
| 41 |
+
subjects = st.text_area(f"Enter Subject Marks for Student {i+1} (comma-separated, e.g., 80,90,70)")
|
| 42 |
+
paper_cleared = st.number_input(f"Number of Papers Cleared for Student {i+1}", min_value=0)
|
|
|
|
| 43 |
|
| 44 |
+
if st.button(f"Calculate Result for Student {i+1}"):
|
| 45 |
+
if student_name and father_name and roll_no and subjects:
|
| 46 |
marks = list(map(int, subjects.split(",")))
|
| 47 |
total_marks = sum(marks)
|
| 48 |
percentage = total_marks / (len(marks) * 100) * 100
|
|
|
|
| 68 |
"father_name": father_name,
|
| 69 |
"percentage": percentage,
|
| 70 |
"grade": grade,
|
| 71 |
+
"subjects": subjects,
|
| 72 |
+
"papers_cleared": paper_cleared
|
| 73 |
}
|
| 74 |
|
| 75 |
# Display Result
|
| 76 |
+
st.write(f"### Result for {student_name}")
|
| 77 |
st.write(f"**School Name:** {school_name}")
|
| 78 |
st.write(f"**Student Name:** {student_name}")
|
| 79 |
st.write(f"**Father's Name:** {father_name}")
|
| 80 |
st.write(f"**Percentage:** {percentage:.2f}%")
|
| 81 |
st.write(f"**Grade:** {grade}")
|
| 82 |
+
st.write(f"**Papers Cleared:** {paper_cleared}")
|
| 83 |
+
st.write(f"**Marks Obtained:** {subjects}")
|
| 84 |
else:
|
| 85 |
+
st.error("Please fill in all fields for the student.")
|
|
|
|
|
|
|
| 86 |
|
| 87 |
elif menu == "Student Section":
|
| 88 |
st.title("Student Section")
|
|
|
|
| 101 |
st.write(f"**Father's Name:** {result['father_name']}")
|
| 102 |
st.write(f"**Percentage:** {result['percentage']:.2f}%")
|
| 103 |
st.write(f"**Grade:** {result['grade']}")
|
| 104 |
+
st.write(f"**Marks Obtained:** {result['subjects']}")
|
| 105 |
+
st.write(f"**Papers Cleared:** {result['papers_cleared']}")
|
| 106 |
else:
|
| 107 |
st.error("Result not found. Please check the roll number.")
|