Anupam251272 commited on
Commit
9f9f228
Β·
verified Β·
1 Parent(s): af554c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -25
app.py CHANGED
@@ -1,8 +1,17 @@
1
  import spacy
2
  from spacy.cli import download
3
  import nltk
 
 
 
 
 
 
 
 
 
4
 
5
- # Ensure punkt tokenizer is downloaded
6
  try:
7
  nltk.data.find('tokenizers/punkt')
8
  except LookupError:
@@ -17,27 +26,7 @@ except OSError:
17
  download("en_core_web_sm")
18
  nlp = spacy.load("en_core_web_sm")
19
 
20
- # Your main application logic follows here
21
-
22
-
23
-
24
- import gradio as gr
25
- import torch
26
- import spacy
27
- import nltk
28
- import re
29
- import PyPDF2
30
- import numpy as np
31
- import pandas as pd
32
- from transformers import pipeline
33
- from sentence_transformers import SentenceTransformer
34
- from sklearn.metrics.pairwise import cosine_similarity
35
-
36
- # Download necessary NLTK resources
37
- nltk.download('punkt')
38
-
39
- # Load spaCy and Sentence Transformer models
40
- nlp = spacy.load('en_core_web_sm')
41
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
42
 
43
  # Check for GPU availability
@@ -94,8 +83,7 @@ CAREER_DATABASE = {
94
  }
95
  }
96
 
97
- # Function definitions remain unchanged
98
-
99
  def extract_text_from_pdf(file_path):
100
  try:
101
  with open(file_path, 'rb') as file:
@@ -106,8 +94,12 @@ def extract_text_from_pdf(file_path):
106
  print(f"Error extracting PDF text: {e}")
107
  return ""
108
 
109
- # Other functions are unchanged
 
 
 
110
 
 
111
  def cv_skill_assessment(cv_file):
112
  try:
113
  cv_text = extract_text_from_pdf(cv_file.name)
 
1
  import spacy
2
  from spacy.cli import download
3
  import nltk
4
+ import gradio as gr
5
+ import torch
6
+ import re
7
+ import PyPDF2
8
+ import numpy as np
9
+ import pandas as pd
10
+ from transformers import pipeline
11
+ from sentence_transformers import SentenceTransformer
12
+ from sklearn.metrics.pairwise import cosine_similarity
13
 
14
+ # Download necessary NLTK resources
15
  try:
16
  nltk.data.find('tokenizers/punkt')
17
  except LookupError:
 
26
  download("en_core_web_sm")
27
  nlp = spacy.load("en_core_web_sm")
28
 
29
+ # Load Sentence Transformer model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
31
 
32
  # Check for GPU availability
 
83
  }
84
  }
85
 
86
+ # Function to extract text from PDF
 
87
  def extract_text_from_pdf(file_path):
88
  try:
89
  with open(file_path, 'rb') as file:
 
94
  print(f"Error extracting PDF text: {e}")
95
  return ""
96
 
97
+ # Placeholder function for CV skill analysis
98
+ def analyze_cv_skills(cv_text):
99
+ # Implement skill analysis and career recommendations
100
+ return "Skill analysis and recommendations coming soon!"
101
 
102
+ # Function to process CV and provide recommendations
103
  def cv_skill_assessment(cv_file):
104
  try:
105
  cv_text = extract_text_from_pdf(cv_file.name)