Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,42 +22,51 @@ is_paid = st.sidebar.checkbox("Paid Subscription ($5/year)")
|
|
| 22 |
with st.sidebar:
|
| 23 |
st.header("Teacher Section")
|
| 24 |
if is_paid:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
school_name = st.text_input("School Name")
|
| 26 |
student_name = st.text_input("Student Name")
|
| 27 |
father_name = st.text_input("Father Name")
|
| 28 |
roll_number = st.text_input("Roll Number")
|
| 29 |
papers_cleared = st.number_input("Papers Cleared", min_value=0, max_value=10, step=1)
|
| 30 |
marks = st.text_area("Enter Marks (comma-separated)", placeholder="e.g., 80, 90, 70")
|
| 31 |
-
|
| 32 |
if st.button("Calculate Result"):
|
| 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 |
else:
|
| 62 |
st.warning("Please complete the $5 subscription to access this section.")
|
| 63 |
|
|
|
|
| 22 |
with st.sidebar:
|
| 23 |
st.header("Teacher Section")
|
| 24 |
if is_paid:
|
| 25 |
+
# Payment information
|
| 26 |
+
st.subheader("Payment Methods")
|
| 27 |
+
easypaisa_account = st.text_input("Easypaisa Account Number")
|
| 28 |
+
jazzcash_account = st.text_input("JazzCash Account Number")
|
| 29 |
+
|
| 30 |
+
# Teacher's inputs
|
| 31 |
school_name = st.text_input("School Name")
|
| 32 |
student_name = st.text_input("Student Name")
|
| 33 |
father_name = st.text_input("Father Name")
|
| 34 |
roll_number = st.text_input("Roll Number")
|
| 35 |
papers_cleared = st.number_input("Papers Cleared", min_value=0, max_value=10, step=1)
|
| 36 |
marks = st.text_area("Enter Marks (comma-separated)", placeholder="e.g., 80, 90, 70")
|
| 37 |
+
|
| 38 |
if st.button("Calculate Result"):
|
| 39 |
+
if not easypaisa_account or not jazzcash_account:
|
| 40 |
+
st.warning("Please enter your Easypaisa or JazzCash account number for payment.")
|
| 41 |
+
else:
|
| 42 |
+
try:
|
| 43 |
+
marks_list = [int(mark.strip()) for mark in marks.split(",") if mark.strip()]
|
| 44 |
+
total_marks = sum(marks_list)
|
| 45 |
+
percentage = total_marks / len(marks_list)
|
| 46 |
+
|
| 47 |
+
# Grade calculation
|
| 48 |
+
if percentage >= 90:
|
| 49 |
+
grade = "A++"
|
| 50 |
+
elif percentage >= 80:
|
| 51 |
+
grade = "A+"
|
| 52 |
+
elif percentage >= 70:
|
| 53 |
+
grade = "A"
|
| 54 |
+
elif percentage >= 60:
|
| 55 |
+
grade = "B"
|
| 56 |
+
elif percentage >= 50:
|
| 57 |
+
grade = "C"
|
| 58 |
+
else:
|
| 59 |
+
grade = "Fail"
|
| 60 |
+
|
| 61 |
+
st.success(f"Results for {student_name}:")
|
| 62 |
+
st.write(f"School: {school_name}")
|
| 63 |
+
st.write(f"Father's Name: {father_name}")
|
| 64 |
+
st.write(f"Roll Number: {roll_number}")
|
| 65 |
+
st.write(f"Papers Cleared: {papers_cleared}")
|
| 66 |
+
st.write(f"Percentage: {percentage:.2f}%")
|
| 67 |
+
st.write(f"Grade: {grade}")
|
| 68 |
+
except Exception as e:
|
| 69 |
+
st.error("Error in input! Ensure marks are entered as comma-separated numbers.")
|
| 70 |
else:
|
| 71 |
st.warning("Please complete the $5 subscription to access this section.")
|
| 72 |
|