nimraaslam7777 commited on
Commit
621bdc5
·
verified ·
1 Parent(s): 9f9c9e3

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +1 -25
  2. main.py +76 -0
  3. requirements.txt +4 -0
README.md CHANGED
@@ -1,25 +1 @@
1
- ---
2
- title: ResumeMatchAI
3
- emoji: 🧠
4
- colorFrom: yellow
5
- colorTo: indigo
6
- sdk: static
7
- pinned: false
8
- ---
9
-
10
- # Nerfies
11
-
12
- This is the repository that contains source code for the [Nerfies website](https://nerfies.github.io).
13
-
14
- If you find Nerfies useful for your work please cite:
15
- ```
16
- @article{park2021nerfies
17
- author = {Park, Keunhong and Sinha, Utkarsh and Barron, Jonathan T. and Bouaziz, Sofien and Goldman, Dan B and Seitz, Steven M. and Martin-Brualla, Ricardo},
18
- title = {Nerfies: Deformable Neural Radiance Fields},
19
- journal = {ICCV},
20
- year = {2021},
21
- }
22
- ```
23
-
24
- # Website License
25
- <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
 
1
+ # -AI-Resume-matching-system
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, render_template
2
+ import os
3
+ import docx2txt
4
+ import PyPDF2
5
+ from sklearn.feature_extraction.text import TfidfVectorizer
6
+ from sklearn.metrics.pairwise import cosine_similarity
7
+
8
+ app = Flask(__name__)
9
+ app.config['UPLOAD_FOLDER'] = 'uploads/'
10
+
11
+ def extract_text_from_pdf(file_path):
12
+ text = ""
13
+ with open(file_path, 'rb') as file:
14
+ reader = PyPDF2.PdfReader(file)
15
+ for page in reader.pages:
16
+ text += page.extract_text()
17
+ return text
18
+
19
+ def extract_text_from_docx(file_path):
20
+ return docx2txt.process(file_path)
21
+
22
+ def extract_text_from_txt(file_path):
23
+ with open(file_path, 'r', encoding='utf-8') as file:
24
+ return file.read()
25
+
26
+ def extract_text(file_path):
27
+ if file_path.endswith('.pdf'):
28
+ return extract_text_from_pdf(file_path)
29
+ elif file_path.endswith('.docx'):
30
+ return extract_text_from_docx(file_path)
31
+ elif file_path.endswith('.txt'):
32
+ return extract_text_from_txt(file_path)
33
+ else:
34
+ return ""
35
+
36
+ @app.route("/")
37
+ def matchresume():
38
+ return render_template('matchresume.html')
39
+
40
+ @app.route('/matcher', methods=['POST'])
41
+ def matcher():
42
+ if request.method == 'POST':
43
+ job_description = request.form['job_description']
44
+ resume_files = request.files.getlist('resumes')
45
+
46
+ resumes = []
47
+ for resume_file in resume_files:
48
+ filename = os.path.join(app.config['UPLOAD_FOLDER'], resume_file.filename)
49
+ resume_file.save(filename)
50
+ resumes.append(extract_text(filename))
51
+
52
+ if not resumes or not job_description:
53
+ return render_template('matchresume.html', message="Please upload resumes and enter a job description.")
54
+
55
+ # Vectorize job description and resumes
56
+ vectorizer = TfidfVectorizer().fit_transform([job_description] + resumes)
57
+ vectors = vectorizer.toarray()
58
+
59
+ # Calculate cosine similarities
60
+ job_vector = vectors[0]
61
+ resume_vectors = vectors[1:]
62
+ similarities = cosine_similarity([job_vector], resume_vectors)[0]
63
+
64
+ # Get top 3 resumes and their similarity scores
65
+ top_indices = similarities.argsort()[-5:][::-1]
66
+ top_resumes = [resume_files[i].filename for i in top_indices]
67
+ similarity_scores = [round(similarities[i], 2) for i in top_indices]
68
+
69
+ return render_template('matchresume.html', message="Top matching resumes:", top_resumes=top_resumes, similarity_scores=similarity_scores)
70
+
71
+ return render_template('matchresume.html')
72
+
73
+ if __name__ == '__main__':
74
+ if not os.path.exists(app.config['UPLOAD_FOLDER']):
75
+ os.makedirs(app.config['UPLOAD_FOLDER'])
76
+ app.run(debug=True)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Flask==2.2.5
2
+ docx2txt==0.8
3
+ PyPDF2==3.0.1
4
+ scikit-learn==1.3.0