Delete app.py
Browse files
app.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
# ---
|
| 2 |
-
# jupyter:
|
| 3 |
-
# jupytext:
|
| 4 |
-
# text_representation:
|
| 5 |
-
# extension: .py
|
| 6 |
-
# format_name: light
|
| 7 |
-
# format_version: '1.5'
|
| 8 |
-
# jupytext_version: 1.16.4
|
| 9 |
-
# kernelspec:
|
| 10 |
-
# display_name: Python 3 (ipykernel)
|
| 11 |
-
# language: python
|
| 12 |
-
# name: python3
|
| 13 |
-
# ---
|
| 14 |
-
|
| 15 |
-
# +
|
| 16 |
-
import streamlit as st
|
| 17 |
-
import pandas as pd
|
| 18 |
-
import numpy as np
|
| 19 |
-
import faiss
|
| 20 |
-
from sentence_transformers import SentenceTransformer
|
| 21 |
-
from huggingface_hub import hf_hub_download
|
| 22 |
-
import warnings
|
| 23 |
-
warnings.filterwarnings('ignore')
|
| 24 |
-
|
| 25 |
-
@st.cache_resource
|
| 26 |
-
def load_artifacts():
|
| 27 |
-
repo_id = "PankhuriSharma9795/SHL_Model_Assets"
|
| 28 |
-
|
| 29 |
-
# Load SBERT model
|
| 30 |
-
model_dir = hf_hub_download(repo_id=repo_id, filename="sbert_model/config.json", repo_type="model")
|
| 31 |
-
model = SentenceTransformer(model_dir.replace("config.json", ""))
|
| 32 |
-
|
| 33 |
-
# Load FAISS index
|
| 34 |
-
faiss_path = hf_hub_download(repo_id=repo_id, filename="faiss_index.index", repo_type="model")
|
| 35 |
-
index = faiss.read_index(faiss_path)
|
| 36 |
-
|
| 37 |
-
# Load CSV
|
| 38 |
-
csv_path = hf_hub_download(repo_id=repo_id, filename="assessment_data.csv", repo_type="model")
|
| 39 |
-
df = pd.read_csv(csv_path)
|
| 40 |
-
|
| 41 |
-
return model, index, df
|
| 42 |
-
|
| 43 |
-
def recommend_assessments(profile_text, model, index, df, top_n=10):
|
| 44 |
-
profile_embedding = model.encode([profile_text]).astype('float32')
|
| 45 |
-
_, indices = index.search(profile_embedding, top_n)
|
| 46 |
-
return df.iloc[indices[0]]
|
| 47 |
-
|
| 48 |
-
# Streamlit UI
|
| 49 |
-
st.title("🔍 SHL Assessment Recommender")
|
| 50 |
-
|
| 51 |
-
profile = st.text_area("✍️ Enter your job role or career aspiration:",
|
| 52 |
-
"Looking for a leadership role in financial planning and client management")
|
| 53 |
-
|
| 54 |
-
if st.button("Get Recommendations"):
|
| 55 |
-
model, index, df = load_artifacts()
|
| 56 |
-
results = recommend_assessments(profile, model, index, df, top_n=10)
|
| 57 |
-
st.subheader("🧠 Top 10 Matching Assessments")
|
| 58 |
-
st.dataframe(results[['Assesment Name', 'cleaned_text', 'Duration',
|
| 59 |
-
'Remote Testing Support', 'URL', 'Adaptive/IRT', 'Job Type']].reset_index(drop=True))
|
| 60 |
-
# -
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|