Spaces:
Sleeping
Sleeping
File size: 4,044 Bytes
c47a5ec 0ae37a4 2a7f6fd 0ae37a4 d9cc936 0ae37a4 2a7f6fd 032429f 0ae37a4 2a7f6fd 0ae37a4 aad9fdf 0ae37a4 d9cc936 0ae37a4 d9cc936 0ae37a4 d9cc936 0ae37a4 aad9fdf 0ae37a4 c5b6462 0ae37a4 c5b6462 d9cc936 c5b6462 0ae37a4 d9cc936 0ae37a4 d9cc936 aad9fdf d9cc936 0ae37a4 aad9fdf 0ae37a4 2a7f6fd c5b6462 0ae37a4 d9cc936 c5b6462 0ae37a4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | import streamlit as st
# Setting the page configuration
st.set_page_config(page_title="Result Checker", layout="wide")
# Customizing the background and text
st.markdown(
"""
<style>
body {
background-color: skyblue;
color: black;
}
.sidebar .sidebar-content {
background-color: #f4f4f4;
}
</style>
""",
unsafe_allow_html=True,
)
# Sidebar for Navigation
st.sidebar.title("Result Checker")
menu = st.sidebar.radio("Choose a Role", ["Teacher Section", "Student Section"])
# Data store for simplicity (in-memory, not persistent)
data_store = {}
if menu == "Teacher Section":
st.title("Teacher Section")
# Input fields for teacher to add multiple students
school_name = st.text_input("School Name")
number_of_students = st.number_input("Enter the number of students", min_value=1, max_value=100, step=1)
for i in range(int(number_of_students)):
st.subheader(f"Student {i+1}")
student_name = st.text_input(f"Student Name {i+1}")
father_name = st.text_input(f"Father's Name {i+1}")
roll_no = st.text_input(f"Roll Number {i+1}")
subjects = st.text_area(f"Enter Subject Marks for Student {i+1} (comma-separated, e.g., 80,90,70)")
paper_cleared = st.number_input(f"Number of Papers Cleared for Student {i+1}", min_value=0)
if st.button(f"Calculate Result for Student {i+1}"):
if student_name and father_name and roll_no and subjects:
marks = list(map(int, subjects.split(",")))
total_marks = sum(marks)
percentage = total_marks / (len(marks) * 100) * 100
# Grade calculation
if percentage > 90:
grade = "A++"
elif percentage > 80:
grade = "A+"
elif percentage > 70:
grade = "A"
elif percentage > 60:
grade = "B"
elif percentage > 50:
grade = "C"
else:
grade = "Fail"
# Store data
data_store[roll_no] = {
"school_name": school_name,
"student_name": student_name,
"father_name": father_name,
"percentage": percentage,
"grade": grade,
"subjects": subjects,
"papers_cleared": paper_cleared
}
# Display Result
st.write(f"### Result for {student_name}")
st.write(f"**School Name:** {school_name}")
st.write(f"**Student Name:** {student_name}")
st.write(f"**Father's Name:** {father_name}")
st.write(f"**Percentage:** {percentage:.2f}%")
st.write(f"**Grade:** {grade}")
st.write(f"**Papers Cleared:** {paper_cleared}")
st.write(f"**Marks Obtained:** {subjects}")
else:
st.error("Please fill in all fields for the student.")
elif menu == "Student Section":
st.title("Student Section")
# Student inputs
school_name = st.text_input("School Name")
class_name = st.text_input("Class")
roll_no = st.text_input("Roll Number")
if st.button("Get Result"):
if roll_no in data_store:
result = data_store[roll_no]
st.write("### Result Summary")
st.write(f"**School Name:** {result['school_name']}")
st.write(f"**Student Name:** {result['student_name']}")
st.write(f"**Father's Name:** {result['father_name']}")
st.write(f"**Percentage:** {result['percentage']:.2f}%")
st.write(f"**Grade:** {result['grade']}")
st.write(f"**Marks Obtained:** {result['subjects']}")
st.write(f"**Papers Cleared:** {result['papers_cleared']}")
else:
st.error("Result not found. Please check the roll number.")
|