Spaces:
Sleeping
Sleeping
halimbahae
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from PyPDF2 import PdfReader
|
4 |
-
import requests
|
5 |
-
from bs4 import BeautifulSoup
|
6 |
|
7 |
# Initialize the Inference Client
|
8 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
@@ -30,27 +28,8 @@ def ats_friendly_checker(file):
|
|
30 |
feedback = response
|
31 |
return feedback
|
32 |
|
33 |
-
def
|
34 |
-
try:
|
35 |
-
headers = {
|
36 |
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
|
37 |
-
}
|
38 |
-
response = requests.get(url, headers=headers)
|
39 |
-
response.raise_for_status()
|
40 |
-
soup = BeautifulSoup(response.text, 'html.parser')
|
41 |
-
job_description = soup.get_text(separator=" ", strip=True)
|
42 |
-
return job_description
|
43 |
-
except requests.exceptions.RequestException as e:
|
44 |
-
return f"Error accessing job description: {e}"
|
45 |
-
except Exception as e:
|
46 |
-
return f"An unexpected error occurred: {e}"
|
47 |
-
|
48 |
-
def resume_match_checker(file, job_url):
|
49 |
resume_text = extract_text_from_pdf(file)
|
50 |
-
job_description = scrape_job_description(job_url)
|
51 |
-
|
52 |
-
if job_description.startswith("Error accessing job description:"):
|
53 |
-
return job_description
|
54 |
|
55 |
system_message = "Compare the following resume with the job description and provide feedback."
|
56 |
message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
|
@@ -108,9 +87,9 @@ with gr.Blocks() as demo:
|
|
108 |
with gr.Tab("Resume Match Checker π"):
|
109 |
with gr.Row():
|
110 |
resume = gr.File(label="Upload your Resume (PDF)")
|
111 |
-
|
112 |
feedback = gr.Textbox(label="Feedback", interactive=False, lines=15, max_lines=50)
|
113 |
-
gr.Button("Check Match").click(resume_match_checker, [resume,
|
114 |
|
115 |
with gr.Tab("Resume Quality Score π"):
|
116 |
with gr.Row():
|
|
|
1 |
import gradio as gr
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from PyPDF2 import PdfReader
|
|
|
|
|
4 |
|
5 |
# Initialize the Inference Client
|
6 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
|
|
28 |
feedback = response
|
29 |
return feedback
|
30 |
|
31 |
+
def resume_match_checker(file, job_description):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
resume_text = extract_text_from_pdf(file)
|
|
|
|
|
|
|
|
|
33 |
|
34 |
system_message = "Compare the following resume with the job description and provide feedback."
|
35 |
message = f"Resume: {resume_text}\n\nJob Description: {job_description}"
|
|
|
87 |
with gr.Tab("Resume Match Checker π"):
|
88 |
with gr.Row():
|
89 |
resume = gr.File(label="Upload your Resume (PDF)")
|
90 |
+
job_description = gr.Textbox(label="Job Description")
|
91 |
feedback = gr.Textbox(label="Feedback", interactive=False, lines=15, max_lines=50)
|
92 |
+
gr.Button("Check Match").click(resume_match_checker, [resume, job_description], feedback)
|
93 |
|
94 |
with gr.Tab("Resume Quality Score π"):
|
95 |
with gr.Row():
|