This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pymongo | |
from pymongo import MongoClient | |
import pandas as pd | |
import pdfplumber | |
import PyPDF2 | |
from rake_nltk import Rake | |
import string | |
import io | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def keyphrases(file,min_word,max_word,num_phrases): | |
text = file | |
text = text.lower() | |
text = ''.join(s for s in text if ord(s)>31 and ord(s)<126) | |
text = text | |
text = re.sub(' +', ' ', text) | |
text = text.translate(str.maketrans('', '',string.punctuation)) | |
text = ''.join([i for i in text if not i.isdigit()]) | |
r = Rake(min_length = min_word, max_length = max_word) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
country = st.sidebar.text_input('Country') | |
uploaded_file = st.file_uploader('Upload your resume') | |
file_text = '' | |
phrases = [] | |
if uploaded_file is not None: | |
uploaded_file.seek(0) | |
file = uploaded_file.read() | |
pdf = PyPDF2.PdfFileReader(io.BytesIO(file)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = pymongo.MongoClient("mongodb+srv://test:<password>@cluster0.nq0me.mongodb.net/<dbname>?retryWrites=true&w=majority") | |
def query(country,keywords): | |
result = client['database1']['collection1'].aggregate([ | |
{ | |
'$search': { | |
'text': { | |
'path': [ | |
'industry' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if st.button('Search'): | |
df = query(country,phrases) | |
st.write(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p ~/.streamlit/ | |
echo "\ | |
[server]\n\ | |
headless = true\n\ | |
port = $PORT\n\ | |
enableCORS = false\n\ | |
\n\ | |
" > ~/.streamlit/config.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: sh setup.sh && streamlit run jobmatch.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import pandas as pd | |
import psycopg2 | |
from sqlalchemy import create_engine | |
from streamlit.report_thread import get_report_ctx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_state(column,value,engine,session_id): | |
engine.execute("UPDATE %s SET %s='%s'" % (session_id,column,value)) | |
def write_state_df(df,engine,session_id): | |
df.to_sql('%s' % (session_id),engine,index=False,if_exists='replace',chunksize=1000) | |
def read_state(column,engine,session_id): | |
state_var = engine.execute("SELECT %s FROM %s" % (column,session_id)) | |
state_var = state_var.first()[0] | |
return state_var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_session_id(): | |
session_id = get_report_ctx().session_id | |
session_id = session_id.replace('-','_') | |
session_id = '_id_' + session_id | |
return session_id |
OlderNewer