hbhamzabaig commited on
Commit
62d21f3
·
verified ·
1 Parent(s): 3ea9b67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
 
3
- # Map total percentage to GPA according to your grading scheme
4
  def percentage_to_gpa(percent):
5
  if percent >= 90:
6
  return 4.00
@@ -41,8 +41,19 @@ def calculate_gpa(w_assign, w_quiz, w_gdb, w_mid, w_final,
41
 
42
  # Build Gradio interface
43
  with gr.Blocks(title="GPA Calculator") as app:
 
 
 
 
 
 
 
 
 
 
 
44
  gr.Markdown("## 📊 GPA Calculator (Out of 4)")
45
- gr.Markdown("Enter weightages and achieved percentages. The final GPA will be displayed on the right.")
46
 
47
  with gr.Row():
48
  # Weightages column
@@ -61,7 +72,13 @@ with gr.Blocks(title="GPA Calculator") as app:
61
  p_quiz = gr.Number(value=85, label="Quiz")
62
  p_gdb = gr.Number(value=90, label="GDB")
63
  p_mid = gr.Number(value=75, label="Mid Term")
64
- p_final = gr.Number(value=50, label="Final Term")
 
 
 
 
 
 
65
 
66
  # GPA column
67
  with gr.Column():
 
1
  import gradio as gr
2
 
3
+ # Map total percentage to GPA based on your grading scheme
4
  def percentage_to_gpa(percent):
5
  if percent >= 90:
6
  return 4.00
 
41
 
42
  # Build Gradio interface
43
  with gr.Blocks(title="GPA Calculator") as app:
44
+
45
+ # Custom CSS for HUGE GPA display
46
+ app.css = """
47
+ #gpa_big textarea {
48
+ font-size: 80px !important;
49
+ font-weight: bold;
50
+ text-align: center;
51
+ color: #1a73e8;
52
+ }
53
+ """
54
+
55
  gr.Markdown("## 📊 GPA Calculator (Out of 4)")
56
+ gr.Markdown("Enter weightages and achieved percentages. Use the slider for Final Term percentage. GPA updates live!")
57
 
58
  with gr.Row():
59
  # Weightages column
 
72
  p_quiz = gr.Number(value=85, label="Quiz")
73
  p_gdb = gr.Number(value=90, label="GDB")
74
  p_mid = gr.Number(value=75, label="Mid Term")
75
+ p_final = gr.Slider(
76
+ minimum=0,
77
+ maximum=100,
78
+ value=50,
79
+ step=1,
80
+ label="Final Term Percentage"
81
+ )
82
 
83
  # GPA column
84
  with gr.Column():