Spaces:
Build error
Build error
this
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ joblib.dump(label_encoders, "label_encoders.pkl")
|
|
| 39 |
|
| 40 |
# Prediction function
|
| 41 |
def predict_colleges(category, gender, rank, region):
|
| 42 |
-
if not isinstance(rank, (int, float)) or rank < 0 or not re.match(r'^\d+$', str(rank)):
|
| 43 |
return "Invalid Rank: Please enter a valid positive integer without symbols."
|
| 44 |
|
| 45 |
# Load label encoders
|
|
@@ -78,12 +78,12 @@ demo = gr.Interface(
|
|
| 78 |
inputs=[
|
| 79 |
gr.Dropdown(choices=["OC", "BC", "SC", "ST"], label="Category"),
|
| 80 |
gr.Radio(choices=["Male", "Female"], label="Gender"),
|
| 81 |
-
gr.
|
| 82 |
gr.Dropdown(choices=["AU", "SV"], label="Region")
|
| 83 |
],
|
| 84 |
outputs=gr.Dataframe(headers=["College Name", "Branch"]),
|
| 85 |
-
title="AP
|
| 86 |
description="Enter your details to predict all possible colleges and branches based on your rank."
|
| 87 |
)
|
| 88 |
|
| 89 |
-
demo.launch()
|
|
|
|
| 39 |
|
| 40 |
# Prediction function
|
| 41 |
def predict_colleges(category, gender, rank, region):
|
| 42 |
+
if not isinstance(rank, (int, float)) or rank < 0 or not re.match(r'^\d+$', str(int(rank))):
|
| 43 |
return "Invalid Rank: Please enter a valid positive integer without symbols."
|
| 44 |
|
| 45 |
# Load label encoders
|
|
|
|
| 78 |
inputs=[
|
| 79 |
gr.Dropdown(choices=["OC", "BC", "SC", "ST"], label="Category"),
|
| 80 |
gr.Radio(choices=["Male", "Female"], label="Gender"),
|
| 81 |
+
gr.Number(precision=0, label="Rank"), # Restrict to whole numbers only
|
| 82 |
gr.Dropdown(choices=["AU", "SV"], label="Region")
|
| 83 |
],
|
| 84 |
outputs=gr.Dataframe(headers=["College Name", "Branch"]),
|
| 85 |
+
title="AP EAPCET College Predictor",
|
| 86 |
description="Enter your details to predict all possible colleges and branches based on your rank."
|
| 87 |
)
|
| 88 |
|
| 89 |
+
demo.launch()
|