dindizz commited on
Commit
8468bb4
·
verified ·
1 Parent(s): 0b51ea6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -15
app.py CHANGED
@@ -3,40 +3,89 @@ import gradio as gr
3
  # Hardcoded NEET cutoff data for top 10 medical colleges in India (example data) by reservation category
4
  colleges_data = {
5
  "All India Institute of Medical Sciences (AIIMS) Delhi": {
6
- "2023": {"GEN": 705, "OBC": 685, "SC": 675, "ST": 670},
7
- "2022": {"GEN": 700, "OBC": 680, "SC": 670, "ST": 665},
8
- "2021": {"GEN": 705, "OBC": 685, "SC": 675, "ST": 670},
 
9
  },
10
  "Maulana Azad Medical College (MAMC) Delhi": {
11
- "2023": {"GEN": 690, "OBC": 675, "SC": 665, "ST": 660},
12
- "2022": {"GEN": 685, "OBC": 670, "SC": 660, "ST": 655},
13
- "2021": {"GEN": 690, "OBC": 675, "SC": 665, "ST": 660},
 
14
  },
15
- # Add more colleges as needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
17
 
18
- # Function to calculate eligible colleges based on NEET score, year, and reservation category
19
- def neet_cutoff_calculator(score, year, category):
20
  eligible_colleges = []
21
  for college, cutoffs in colleges_data.items():
22
- if year in cutoffs and category in cutoffs[year] and score >= cutoffs[year][category]:
23
- eligible_colleges.append(college)
 
24
  return eligible_colleges
25
 
26
  # Function for Gradio interface
27
- def calculate_colleges(score, year, category):
28
- eligible_colleges = neet_cutoff_calculator(score, year, category)
29
  if eligible_colleges:
30
  return f"With a score of {score}, you are eligible for admission to the following colleges: {', '.join(eligible_colleges)}"
31
  else:
32
- return "Unfortunately, no colleges match your score for the selected year and category."
33
 
34
  # Create the Gradio interface using the updated syntax
35
  iface = gr.Interface(
36
  fn=calculate_colleges,
37
  inputs=[
38
  gr.Slider(0, 720, label="NEET Score"),
39
- gr.Dropdown(["2023", "2022", "2021"], label="Year"),
40
  gr.Dropdown(["GEN", "OBC", "SC", "ST"], label="Category")
41
  ],
42
  outputs="text",
 
3
  # Hardcoded NEET cutoff data for top 10 medical colleges in India (example data) by reservation category
4
  colleges_data = {
5
  "All India Institute of Medical Sciences (AIIMS) Delhi": {
6
+ "GEN": [705, 700, 705],
7
+ "OBC": [685, 680, 685],
8
+ "SC": [675, 670, 675],
9
+ "ST": [670, 665, 670],
10
  },
11
  "Maulana Azad Medical College (MAMC) Delhi": {
12
+ "GEN": [690, 685, 690],
13
+ "OBC": [675, 670, 675],
14
+ "SC": [665, 660, 665],
15
+ "ST": [660, 655, 660],
16
  },
17
+ "Christian Medical College (CMC) Vellore": {
18
+ "GEN": [675, 670, 675],
19
+ "OBC": [660, 655, 660],
20
+ "SC": [650, 645, 650],
21
+ "ST": [645, 640, 645],
22
+ },
23
+ "King George's Medical University (KGMU) Lucknow": {
24
+ "GEN": [665, 660, 665],
25
+ "OBC": [650, 645, 650],
26
+ "SC": [640, 635, 640],
27
+ "ST": [635, 630, 635],
28
+ },
29
+ "Jawaharlal Institute of Postgraduate Medical Education & Research (JIPMER) Puducherry": {
30
+ "GEN": [670, 665, 670],
31
+ "OBC": [655, 650, 655],
32
+ "SC": [645, 640, 645],
33
+ "ST": [640, 635, 640],
34
+ },
35
+ "Grant Medical College Mumbai": {
36
+ "GEN": [655, 650, 655],
37
+ "OBC": [640, 635, 640],
38
+ "SC": [630, 625, 630],
39
+ "ST": [625, 620, 625],
40
+ },
41
+ "Seth GS Medical College Mumbai": {
42
+ "GEN": [660, 655, 660],
43
+ "OBC": [645, 640, 645],
44
+ "SC": [635, 630, 635],
45
+ "ST": [630, 625, 630],
46
+ },
47
+ "Banaras Hindu University (BHU) Varanasi": {
48
+ "GEN": [675, 670, 675],
49
+ "OBC": [660, 655, 660],
50
+ "SC": [650, 645, 650],
51
+ "ST": [645, 640, 645],
52
+ },
53
+ "Lady Hardinge Medical College (LHMC) Delhi": {
54
+ "GEN": [680, 675, 680],
55
+ "OBC": [665, 660, 665],
56
+ "SC": [655, 650, 655],
57
+ "ST": [650, 645, 650],
58
+ },
59
+ "University College of Medical Sciences (UCMS) Delhi": {
60
+ "GEN": [685, 680, 685],
61
+ "OBC": [670, 665, 670],
62
+ "SC": [660, 655, 660],
63
+ "ST": [655, 650, 655],
64
+ }
65
  }
66
 
67
+ # Function to calculate eligible colleges based on NEET score and reservation category
68
+ def neet_cutoff_calculator(score, category):
69
  eligible_colleges = []
70
  for college, cutoffs in colleges_data.items():
71
+ average_cutoff = sum(cutoffs[category]) / len(cutoffs[category])
72
+ if score >= average_cutoff:
73
+ eligible_colleges.append(f"{college} (Avg Cutoff: {average_cutoff:.2f})")
74
  return eligible_colleges
75
 
76
  # Function for Gradio interface
77
+ def calculate_colleges(score, category):
78
+ eligible_colleges = neet_cutoff_calculator(score, category)
79
  if eligible_colleges:
80
  return f"With a score of {score}, you are eligible for admission to the following colleges: {', '.join(eligible_colleges)}"
81
  else:
82
+ return "Unfortunately, no colleges match your score for the selected category."
83
 
84
  # Create the Gradio interface using the updated syntax
85
  iface = gr.Interface(
86
  fn=calculate_colleges,
87
  inputs=[
88
  gr.Slider(0, 720, label="NEET Score"),
 
89
  gr.Dropdown(["GEN", "OBC", "SC", "ST"], label="Category")
90
  ],
91
  outputs="text",