Spaces:
Sleeping
Sleeping
from flask import Flask, render_template, request, jsonify | |
from model import get_colleges, get_courses_for_zone # Import the model function | |
import pandas as pd | |
import pickle | |
app = Flask(__name__) | |
zones = ['Amravati', 'Pune', 'Aurangabad', 'Mumbai & Thane', 'Konkan', 'Nagpur', 'Nashik'] | |
seat_levels = ['Home', 'State', 'Other Than Home'] | |
categories = ['OPEN', 'SC', 'ST', 'VJ', 'NT1', 'NT2', 'NT3', 'OBC', 'DEFOPEN', | |
'TFW', 'DEFROBC', 'EW', 'PWDOPEN', 'PWDRSC', 'DEFRSC', 'PWDROBC', | |
'M', 'DEFOBC', 'DEFRNT1', 'DEFRNT2', 'ORPHA', 'PWDRVJ', 'PWDOBC', | |
'PWDRNT1', 'DEFRNT3', 'DEFRVJ', 'DEFSC', 'PWDRNT2', 'PWDSC', | |
'PWDRNT3', 'PWDRST', 'DEFRST', 'PWDROB'] | |
def index(): | |
colleges_data = None | |
if request.method == 'POST': | |
# Get data from the form | |
marks = float(request.form['marks']) | |
zone = request.form['zone'] | |
course = request.form['course'] | |
category = request.form['category'] | |
gender = request.form['gender'] | |
seat_level = request.form['seat_level'] | |
round = 1 | |
print(marks, zone, course, category, gender, seat_level, round) | |
# Call the get_colleges function to predict the list of colleges | |
colleges_data = get_colleges(marks, zone, course, category, gender, seat_level, round) | |
return render_template('index.html', colleges_data=colleges_data, zones = zones, categories = categories, seat_levels = seat_levels) | |
def get_courses(): | |
zone = request.json['zone'] | |
courses = get_courses_for_zone(zone) | |
courses = courses.tolist() | |
return jsonify(courses) | |
if __name__ == '__main__': | |
app.run(debug=True) |