Spaces:
Build error
Build error
File size: 1,855 Bytes
08af8da 3ff3519 08af8da 3ff3519 e851e40 3ff3519 08af8da e851e40 013ad38 08af8da |
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 |
import streamlit as st
import pandas as pd
import json
from utils import (
get_prob,
device,
get_prob_lists,
compare_sentence,
query_jds,
query,
tfidf_score,
tfidf_matrix,
)
from ast import literal_eval
from stqdm import stqdm
with open("joblists.txt") as file:
lines = file.readlines()
jobs = [line.rstrip() for line in lines]
DB = pd.read_csv("JDs_final.csv").dropna()
DB.details = DB.details.apply(lambda x: literal_eval(x))
DB.tokenized = DB.tokenized.apply(lambda x: literal_eval(x))
DB = DB.drop_duplicates(["description"])
data = pd.read_csv("processed_courses_data.csv")
def get_recommendation(DB, data, jobname, by="course_info"):
JD_sentences = query_jds(DB, jobname).description.values
DB["Query_Score"] = DB.description.progress_apply(
lambda x: compare_sentence(x, jobs[0])
)
target = DB.sort_values(by="Query_Score", ascending=False)[:10]
JD_sentences = target.description.values
data["Recommendation_score"] = data[by].progress_apply(
lambda x: compare_sentence(x, JD_sentences)
)
return data.sort_values(by="Recommendation_score", ascending=False)[:26][
["Course_Name", "course_info", "syllabus", "div", "Recommendation_score"]
]
st.title("Course Recommender🤔")
if device == "cpu":
processor = "🖥️"
else:
processor = "💽"
st.subheader("Running on {}".format(device + processor))
option = st.checkbox("💻From referece IT jobs?")
if option:
job = st.selectbox("Choose your job", jobs)
else:
job = st.text_input("Put job you are interested")
btn = st.button("Run recommendation!")
stqdm.pandas()
if btn:
with st.spinner("⌛Generating Recommendation!"):
recommendation = get_recommendation(DB, data, job)
st.success("Recommended course for {} ".format(job))
st.write(recommendation)
|