neetcalculator / app.py
dindizz's picture
Update app.py
8468bb4 verified
import gradio as gr
# Hardcoded NEET cutoff data for top 10 medical colleges in India (example data) by reservation category
colleges_data = {
"All India Institute of Medical Sciences (AIIMS) Delhi": {
"GEN": [705, 700, 705],
"OBC": [685, 680, 685],
"SC": [675, 670, 675],
"ST": [670, 665, 670],
},
"Maulana Azad Medical College (MAMC) Delhi": {
"GEN": [690, 685, 690],
"OBC": [675, 670, 675],
"SC": [665, 660, 665],
"ST": [660, 655, 660],
},
"Christian Medical College (CMC) Vellore": {
"GEN": [675, 670, 675],
"OBC": [660, 655, 660],
"SC": [650, 645, 650],
"ST": [645, 640, 645],
},
"King George's Medical University (KGMU) Lucknow": {
"GEN": [665, 660, 665],
"OBC": [650, 645, 650],
"SC": [640, 635, 640],
"ST": [635, 630, 635],
},
"Jawaharlal Institute of Postgraduate Medical Education & Research (JIPMER) Puducherry": {
"GEN": [670, 665, 670],
"OBC": [655, 650, 655],
"SC": [645, 640, 645],
"ST": [640, 635, 640],
},
"Grant Medical College Mumbai": {
"GEN": [655, 650, 655],
"OBC": [640, 635, 640],
"SC": [630, 625, 630],
"ST": [625, 620, 625],
},
"Seth GS Medical College Mumbai": {
"GEN": [660, 655, 660],
"OBC": [645, 640, 645],
"SC": [635, 630, 635],
"ST": [630, 625, 630],
},
"Banaras Hindu University (BHU) Varanasi": {
"GEN": [675, 670, 675],
"OBC": [660, 655, 660],
"SC": [650, 645, 650],
"ST": [645, 640, 645],
},
"Lady Hardinge Medical College (LHMC) Delhi": {
"GEN": [680, 675, 680],
"OBC": [665, 660, 665],
"SC": [655, 650, 655],
"ST": [650, 645, 650],
},
"University College of Medical Sciences (UCMS) Delhi": {
"GEN": [685, 680, 685],
"OBC": [670, 665, 670],
"SC": [660, 655, 660],
"ST": [655, 650, 655],
}
}
# Function to calculate eligible colleges based on NEET score and reservation category
def neet_cutoff_calculator(score, category):
eligible_colleges = []
for college, cutoffs in colleges_data.items():
average_cutoff = sum(cutoffs[category]) / len(cutoffs[category])
if score >= average_cutoff:
eligible_colleges.append(f"{college} (Avg Cutoff: {average_cutoff:.2f})")
return eligible_colleges
# Function for Gradio interface
def calculate_colleges(score, category):
eligible_colleges = neet_cutoff_calculator(score, category)
if eligible_colleges:
return f"With a score of {score}, you are eligible for admission to the following colleges: {', '.join(eligible_colleges)}"
else:
return "Unfortunately, no colleges match your score for the selected category."
# Create the Gradio interface using the updated syntax
iface = gr.Interface(
fn=calculate_colleges,
inputs=[
gr.Slider(0, 720, label="NEET Score"),
gr.Dropdown(["GEN", "OBC", "SC", "ST"], label="Category")
],
outputs="text",
title="NEET Cut-Off Calculator by Category"
)
# Launch the interface
iface.launch()