File size: 4,662 Bytes
134789a 1e24a1d 134789a 2cb0cdc 134789a 9f66c84 2cb0cdc 9f66c84 2cb0cdc 134789a 2cb0cdc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
import requests
import pandas as pd
import streamlit as st
# π Your deployed Flask backend URL
BACKEND_URL = "https://Pushpak21-EngineeringGeneral.hf.space/predict"
st.title("π― Engineering College Predictor")
st.write("Enter your details below:")
# π Input controls
category = st.selectbox("Category", ['GOPEN', 'GSC', 'GSEBC', 'LOPEN', 'LST', 'LOBC', 'EWS', 'GST',
'GOBC', 'LSEBC', 'LSC', 'GNTA', 'LNTB', 'GNTB', 'GNTC', 'LNTA',
'GNTD', 'LNTC', 'LNTD', 'ORP'])
course_list = [
'Civil Engineering', 'Computer Science and Engineering',
'Information Technology', 'Electrical Engineering',
'Electronics and Telecommunication Engg',
'Instrumentation Engineering', 'Mechanical Engineering',
'Computer Engineering', 'Electrical Engg[Electronics and Power]',
'Artificial Intelligence (AI) and Data Science', 'Industrial IoT',
'Artificial Intelligence and Data Science', 'Chemical Engineering',
'Computer Science and Engineering(Data Science)',
'Production Engineering', 'Textile Technology',
'Electronics and Computer Engineering',
'Computer Science and Engineering(Artificial Intelligence and Machine Learning)',
'Agricultural Engineering', 'Computer Science and Design',
'Plastic and Polymer Engineering', 'Electronics Engineering',
'Electrical and Electronics Engineering',
'Artificial Intelligence and Machine Learning',
'Electronics Engineering ( VLSI Design and Technology)',
'Electronics and Communication(Advanced Communication Technology)',
'Artificial Intelligence', 'Production Engineering[Sandwich]',
'Electronics and Telecommunication Engg[Direct Second Year Second Shift]',
'Petro Chemical Engineering', 'Computer Science and Technology',
'Electronics and Communication Engineering', 'Data Science',
'Mechatronics Engineering', 'Civil and infrastructure Engineering',
'Bio Medical Engineering', 'Electronics and Computer Science',
'Computer Science and Engineering (Internet of Things and Cyber Security Including Block Chain Technology)',
'Cyber Security', 'Mechanical & Automation Engineering',
'Food Technology', 'Paper and Pulp Technology',
'Computer Technology', 'Aeronautical Engineering',
'Mining Engineering', 'Computer Science and Engineering (IoT)',
'Oil Fats and Waxes Technology', 'Paints Technology',
'Instrumentation and Control Engineering',
'Automation and Robotics', 'Robotics and Automation',
'Structural Engineering', 'Civil and Environmental Engineering',
'Automobile Engineering', 'Robotics and Artificial Intelligence',
'Manufacturing Science and Engineering',
'Metallurgy and Material Technology',
'Computer Science and Business Systems',
'Computer Engineering (Software Engineering)',
'Computer Engineering[Direct Second Year Second Shift]',
'Computer Science and Information Technology',
'Fashion Technology', 'Textile Plant Engineering',
'Computer Science and Engineering (Artificial Intelligence and Data Science)',
'Electrical and Computer Engineering', 'Printing Technology',
'Mechanical Engineering[Sandwich]',
'Computer Science and Engineering (Artificial Intelligence)'
]
# Sort alphabetically
course_list_sorted = sorted(course_list)
course = st.selectbox("Category", course_list_sorted)
rank = st.number_input("Rank", min_value=1, value=1500)
percentage = st.number_input("Percentage", min_value=0.0, max_value=100.0, value=75.0)
if st.button("Predict Top 20 Choices"):
payload = {
"Category": category,
"Rank": rank,
"Percentage": percentage,
"Course Name": course
}
# π· Call your backend API
resp = requests.post(BACKEND_URL, json=payload)
if resp.status_code != 200:
st.error(f"Backend error: {resp.status_code}")
st.write(resp.text)
else:
data = resp.json().get("top_20_predictions", [])
if not data:
st.warning("No predictions returned.")
else:
df = pd.DataFrame(data)
# Reorder & rename columns
df = df[["rank", "choice_code", "college_name", "probability_percent"]]
df.rename(columns={
"rank": "Rank",
"choice_code": "Choice Code",
"college_name": "College Name",
"probability_percent": "Probability (%)"
}, inplace=True)
# π― Display table without index and full width
st.write("### π― Topβ20 Predicted Choices")
st.dataframe(
df.style.hide(axis="index"),
use_container_width=True
) |