Vaibhav84 commited on
Commit
f605067
·
1 Parent(s): 93bcfa8

Jd Extraction

Browse files
Files changed (1) hide show
  1. app.py +41 -27
app.py CHANGED
@@ -311,8 +311,16 @@ def SkillMatcher():
311
  cursor_obj.close()
312
  conn.close()
313
 
314
-
315
-
 
 
 
 
 
 
 
 
316
 
317
  def uploadFile(text,filePath):
318
  conn = psycopg2.connect(**db_params)
@@ -326,49 +334,55 @@ def uploadFile(text,filePath):
326
  conn.commit()
327
  print("File Uploaded...")
328
 
329
- def AppFlow(text,fName):
 
330
  with st.spinner('Processing...'):
331
-
332
- uploadFile(str(text),fName)
333
- SkillExtract()
334
- profile = SkillMatcher()
335
- details = latestSkillDetails(1).split('@')
 
 
 
 
 
 
 
336
 
337
- st.subheader('Required Skills : ', divider='rainbow')
338
- st.write(details[0])
339
- st.subheader('Required Soft Skills : ', divider='rainbow')
340
- st.write(details[1])
341
- st.subheader('Good to have Skills : ', divider='rainbow')
342
- st.write(details[2] + " " + details[3])
343
- st.success('Profile Tagging - ' + profile)
344
 
345
- def submit (uploaded_resume, query):
346
 
 
 
 
347
  if uploaded_resume:
348
 
349
  fName = uploaded_resume.name
350
  if fName.endswith("pdf"):
351
  pdf_reader = PdfReader(uploaded_resume)
352
- text = ""
353
  for page in pdf_reader.pages:
354
  text += page.extract_text()
355
  #text = extract_text(filePath)
356
 
357
  elif fName.endswith("doc") or fName.endswith("docx"):
358
- text = StringIO(uploaded_resume.getvalue().decode("utf-8"))
359
- text = text.read()
360
 
361
  else:
362
  text = uploaded_resume.getvalue().decode()
363
  #Pdf Text Extraction
364
-
365
-
366
-
367
- if query:
368
- AppFlow(text,fName)
369
-
370
- else:
371
- AppFlow(text,fName)
372
 
373
 
374
 
 
311
  cursor_obj.close()
312
  conn.close()
313
 
314
+ def LatestExtractedSkills():
315
+ dbQuery = "select * from LatestSkills"
316
+ conn = psycopg2.connect(**db_params)
317
+ df = pd.read_sql_query(dbQuery, conn)
318
+ st.dataframe(df,use_container_width = True, hide_index = True)
319
+ def Last20JD():
320
+ dbQuery = "select * from TopJD"
321
+ conn = psycopg2.connect(**db_params)
322
+ df = pd.read_sql_query(dbQuery, conn)
323
+ st.dataframe(df,use_container_width = True, hide_index = True)
324
 
325
  def uploadFile(text,filePath):
326
  conn = psycopg2.connect(**db_params)
 
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()
342
+ st.success('Skills extracted from recent JDs')
343
+ elif(query.upper() == 'JD'):
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()
351
+ details = latestSkillDetails(1).split('@')
352
 
353
+ st.subheader('Required Skills : ', divider='rainbow')
354
+ st.write(details[0])
355
+ st.subheader('Required Soft Skills : ', divider='rainbow')
356
+ st.write(details[1])
357
+ st.subheader('Good to have Skills : ', divider='rainbow')
358
+ st.write(details[2] + " " + details[3])
 
359
 
360
+ st.success('Profile Tagging - ' + profile)
361
 
362
+ def submit (uploaded_resume, query):
363
+ text = ""
364
+ fName = ""
365
  if uploaded_resume:
366
 
367
  fName = uploaded_resume.name
368
  if fName.endswith("pdf"):
369
  pdf_reader = PdfReader(uploaded_resume)
370
+
371
  for page in pdf_reader.pages:
372
  text += page.extract_text()
373
  #text = extract_text(filePath)
374
 
375
  elif fName.endswith("doc") or fName.endswith("docx"):
376
+ text = StringIO(uploaded_resume.getvalue().decode("utf-8"))
377
+ text = text.read()
378
 
379
  else:
380
  text = uploaded_resume.getvalue().decode()
381
  #Pdf Text Extraction
382
+
383
+ AppFlow(text,fName,query, True)
384
+ else:
385
+ AppFlow(text,fName,query, False)
 
 
 
 
386
 
387
 
388