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 )