Pushpak21 commited on
Commit
c5a6e84
Β·
verified Β·
1 Parent(s): 85b8bcb

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +9 -8
src/streamlit_app.py CHANGED
@@ -2,13 +2,13 @@ import requests
2
  import pandas as pd
3
  import streamlit as st
4
 
5
- # ←––– Point this at your deployed Flask API
6
  BACKEND_URL = "https://Pushpak21-Pharmacy.hf.space/predict"
7
 
8
  st.title("🎯 Pharmacy College Predictor")
9
  st.write("Enter your details below:")
10
 
11
- # Input controls
12
  category = st.selectbox("Category", [
13
  'GOPEN', 'GSC', 'GNTB', 'GOBC', 'GSEBC', 'LOPEN', 'LST', 'LOBC',
14
  'EWS', 'GST', 'GNTC', 'LSC', 'LNTB', 'LNTD', 'LNTC', 'LSEBC',
@@ -24,7 +24,7 @@ if st.button("Predict Top 20 Choices"):
24
  "Percentage": percentage
25
  }
26
 
27
- # Call your backend API
28
  resp = requests.post(BACKEND_URL, json=payload)
29
  if resp.status_code != 200:
30
  st.error(f"Backend error: {resp.status_code}")
@@ -36,17 +36,18 @@ if st.button("Predict Top 20 Choices"):
36
  else:
37
  df = pd.DataFrame(data)
38
 
39
- # Rename columns for clarity
 
40
  df.rename(columns={
41
- "Rank": "Prediction Rank",
42
  "choice_code": "Choice Code",
43
- "college_name": "College Name"
 
44
  }, inplace=True)
45
 
46
- # Display table without index and full width
47
  st.write("### 🎯 Top‑20 Predicted Choices")
48
  st.dataframe(
49
  df.style.hide(axis="index"),
50
  use_container_width=True
51
  )
52
-
 
2
  import pandas as pd
3
  import streamlit as st
4
 
5
+ # πŸš€ Your deployed Flask backend URL
6
  BACKEND_URL = "https://Pushpak21-Pharmacy.hf.space/predict"
7
 
8
  st.title("🎯 Pharmacy College Predictor")
9
  st.write("Enter your details below:")
10
 
11
+ # πŸ“‹ Input controls
12
  category = st.selectbox("Category", [
13
  'GOPEN', 'GSC', 'GNTB', 'GOBC', 'GSEBC', 'LOPEN', 'LST', 'LOBC',
14
  'EWS', 'GST', 'GNTC', 'LSC', 'LNTB', 'LNTD', 'LNTC', 'LSEBC',
 
24
  "Percentage": percentage
25
  }
26
 
27
+ # πŸ”· Call your backend API
28
  resp = requests.post(BACKEND_URL, json=payload)
29
  if resp.status_code != 200:
30
  st.error(f"Backend error: {resp.status_code}")
 
36
  else:
37
  df = pd.DataFrame(data)
38
 
39
+ # Reorder & rename columns
40
+ df = df[["rank", "choice_code", "college_name", "probability_percent"]]
41
  df.rename(columns={
42
+ "rank": "Rank",
43
  "choice_code": "Choice Code",
44
+ "college_name": "College Name",
45
+ "probability_percent": "Probability (%)"
46
  }, inplace=True)
47
 
48
+ # 🎯 Display table without index and full width
49
  st.write("### 🎯 Top‑20 Predicted Choices")
50
  st.dataframe(
51
  df.style.hide(axis="index"),
52
  use_container_width=True
53
  )