Query Changes
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
from PyPDF2 import PdfReader
|
3 |
import psycopg2
|
4 |
from psycopg2 import sql
|
@@ -323,19 +324,30 @@ def Last20JD():
|
|
323 |
st.dataframe(df,use_container_width = True, hide_index = True)
|
324 |
|
325 |
def uploadFile(text,filePath):
|
|
|
|
|
|
|
326 |
conn = psycopg2.connect(**db_params)
|
327 |
cursor = conn.cursor()
|
328 |
query = "Select max(jdmasterid) from JdMaster"
|
329 |
df = pd.read_sql_query(query, conn)
|
330 |
MasterId = df.iat[0,0] + 1
|
|
|
331 |
#print(MasterId)
|
332 |
-
query =sql.SQL("""INSERT INTO JDMaster (jdmasterid,jobdescription, filename, UploadedDate, IsDetailsExtracted,IsSkillsExtracted,source) VALUES (%s,%s,%s,%s,%s,%s,%s)""")
|
333 |
-
cursor.execute(query, (MasterId,text,filePath, date.today(),0,0,"JD"))
|
334 |
conn.commit()
|
|
|
|
|
335 |
print("File Uploaded...")
|
336 |
|
337 |
def AppFlow(text,fName,query, IsUpload):
|
338 |
profile=""
|
|
|
|
|
|
|
|
|
|
|
339 |
with st.spinner('Processing...'):
|
340 |
if(query.upper() == 'SKILLS'):
|
341 |
LatestExtractedSkills()
|
@@ -344,7 +356,7 @@ def AppFlow(text,fName,query, IsUpload):
|
|
344 |
Last20JD()
|
345 |
st.success('Recently uploaded JDs')
|
346 |
else:
|
347 |
-
if(IsUpload and query == ''):
|
348 |
uploadFile(str(text),fName)
|
349 |
SkillExtract()
|
350 |
profile = SkillMatcher()
|
|
|
1 |
import streamlit as st
|
2 |
+
import socket
|
3 |
from PyPDF2 import PdfReader
|
4 |
import psycopg2
|
5 |
from psycopg2 import sql
|
|
|
324 |
st.dataframe(df,use_container_width = True, hide_index = True)
|
325 |
|
326 |
def uploadFile(text,filePath):
|
327 |
+
hostname = socket.gethostname()
|
328 |
+
## getting the IP address using socket.gethostbyname() method
|
329 |
+
ip_address = socket.gethostbyname(hostname)
|
330 |
conn = psycopg2.connect(**db_params)
|
331 |
cursor = conn.cursor()
|
332 |
query = "Select max(jdmasterid) from JdMaster"
|
333 |
df = pd.read_sql_query(query, conn)
|
334 |
MasterId = df.iat[0,0] + 1
|
335 |
+
uploadedBy = hostname + ip_address
|
336 |
#print(MasterId)
|
337 |
+
query =sql.SQL("""INSERT INTO JDMaster (jdmasterid,jobdescription, filename, UploadedDate, IsDetailsExtracted,IsSkillsExtracted,source,uploadedby) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)""")
|
338 |
+
cursor.execute(query, (MasterId,text,filePath, date.today(),0,0,"JD", uploadedBy))
|
339 |
conn.commit()
|
340 |
+
print(hostname)
|
341 |
+
print(ip_address)
|
342 |
print("File Uploaded...")
|
343 |
|
344 |
def AppFlow(text,fName,query, IsUpload):
|
345 |
profile=""
|
346 |
+
if(IsUpload == False and len(query) > 10):
|
347 |
+
text = query
|
348 |
+
IsUpload = True
|
349 |
+
query = ''
|
350 |
+
fName = 'Open Text'
|
351 |
with st.spinner('Processing...'):
|
352 |
if(query.upper() == 'SKILLS'):
|
353 |
LatestExtractedSkills()
|
|
|
356 |
Last20JD()
|
357 |
st.success('Recently uploaded JDs')
|
358 |
else:
|
359 |
+
if(IsUpload and query == ''):
|
360 |
uploadFile(str(text),fName)
|
361 |
SkillExtract()
|
362 |
profile = SkillMatcher()
|