File size: 1,766 Bytes
f680567
526389d
 
 
c5a6e84
f680567
 
 
 
 
c5a6e84
f680567
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c5a6e84
f680567
 
 
 
 
 
 
 
 
 
85b8bcb
c5a6e84
 
85b8bcb
c5a6e84
85b8bcb
c5a6e84
 
85b8bcb
 
c5a6e84
85b8bcb
 
 
 
 
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
import requests
import pandas as pd
import streamlit as st

# πŸš€ Your deployed Flask backend URL
BACKEND_URL = "https://Pushpak21-Pharmacy.hf.space/predict"

st.title("🎯 Pharmacy College Predictor")
st.write("Enter your details below:")

# πŸ“‹ Input controls
category = st.selectbox("Category", [
    'GOPEN', 'GSC', 'GNTB', 'GOBC', 'GSEBC', 'LOPEN', 'LST', 'LOBC',
    'EWS', 'GST', 'GNTC', 'LSC', 'LNTB', 'LNTD', 'LNTC', 'LSEBC',
    'GNTA', 'GNTD', 'LNTA'
])
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
    }

    # πŸ”· 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
            )