Spaces:
Runtime error
Runtime error
PRASHANTH REDDY
commited on
Commit
·
38b54e1
1
Parent(s):
b9169bd
actual Labels
Browse files- app.py +13 -5
- reuirements.txt +2 -1
app.py
CHANGED
|
@@ -3,8 +3,6 @@ import fitz
|
|
| 3 |
import os
|
| 4 |
import re
|
| 5 |
from joblib import load
|
| 6 |
-
from sklearn.feature_extraction.text import TfidfVectorizer
|
| 7 |
-
|
| 8 |
|
| 9 |
def extract_text_from_pdf(file_path):
|
| 10 |
text = ""
|
|
@@ -27,14 +25,24 @@ def load_model():
|
|
| 27 |
model = load('Resume_Screening.joblib')
|
| 28 |
return model
|
| 29 |
|
| 30 |
-
vectorizer=load('Word_Vec_Resume.joblib')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
def predict(file_path):
|
| 32 |
text = extract_text_from_pdf(file_path)
|
| 33 |
text = preprocess_text(text)
|
| 34 |
text_vectorized = vectorizer.transform([text])
|
| 35 |
model = load_model()
|
| 36 |
result = model.predict(text_vectorized)
|
| 37 |
-
|
|
|
|
|
|
|
| 38 |
|
| 39 |
iface = gr.Interface(
|
| 40 |
fn=predict,
|
|
@@ -42,4 +50,4 @@ iface = gr.Interface(
|
|
| 42 |
outputs="text"
|
| 43 |
)
|
| 44 |
|
| 45 |
-
iface.launch()
|
|
|
|
| 3 |
import os
|
| 4 |
import re
|
| 5 |
from joblib import load
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def extract_text_from_pdf(file_path):
|
| 8 |
text = ""
|
|
|
|
| 25 |
model = load('Resume_Screening.joblib')
|
| 26 |
return model
|
| 27 |
|
| 28 |
+
vectorizer = load('Word_Vec_Resume.joblib')
|
| 29 |
+
actual_labels = [
|
| 30 |
+
"Advocate", "Arts", "Automation Testing", "Blockchain", "Business Analyst",
|
| 31 |
+
"Civil Engineer", "Data Science", "Database", "DevOps Engineer", "DotNet Developer",
|
| 32 |
+
"ETL Developer", "Electrical Engineering", "HR", "Hadoop", "Health and fitness",
|
| 33 |
+
"Java Developer", "Mechanical Engineer", "Network Security Engineer", "Operations Manager",
|
| 34 |
+
"PMO", "Python Developer", "SAP Developer", "Sales", "Testing", "Web Designing"
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
def predict(file_path):
|
| 38 |
text = extract_text_from_pdf(file_path)
|
| 39 |
text = preprocess_text(text)
|
| 40 |
text_vectorized = vectorizer.transform([text])
|
| 41 |
model = load_model()
|
| 42 |
result = model.predict(text_vectorized)
|
| 43 |
+
actual_result = [actual_labels[label] for label in result]
|
| 44 |
+
result=actual_result[0]
|
| 45 |
+
return result
|
| 46 |
|
| 47 |
iface = gr.Interface(
|
| 48 |
fn=predict,
|
|
|
|
| 50 |
outputs="text"
|
| 51 |
)
|
| 52 |
|
| 53 |
+
iface.launch()
|
reuirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ PyMuPDF
|
|
| 4 |
fitz
|
| 5 |
os
|
| 6 |
re
|
| 7 |
-
sci-kit-learn
|
|
|
|
|
|
| 4 |
fitz
|
| 5 |
os
|
| 6 |
re
|
| 7 |
+
sci-kit-learn
|
| 8 |
+
python=`
|