Skip to content

Instantly share code, notes, and snippets.

View mkhorasani's full-sized avatar

Mohammad Khorasani mkhorasani

View GitHub Profile
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
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)
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))
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'
mkdir -p ~/.streamlit/
echo "\
[server]\n\
headless = true\n\
port = $PORT\n\
enableCORS = false\n\
\n\
" > ~/.streamlit/config.toml
web: sh setup.sh && streamlit run jobmatch.py
import streamlit as st
import pandas as pd
import psycopg2
from sqlalchemy import create_engine
from streamlit.report_thread import get_report_ctx
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
def get_session_id():
session_id = get_report_ctx().session_id
session_id = session_id.replace('-','_')
session_id = '_id_' + session_id
return session_id