Spaces:
Running
Running
Update model.py
Browse files
model.py
CHANGED
@@ -1,18 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
import logging
|
4 |
-
from sentence_transformers import SentenceTransformer
|
5 |
|
6 |
# Configure logging
|
7 |
logging.basicConfig(level=logging.INFO)
|
8 |
logger = logging.getLogger(__name__)
|
9 |
|
10 |
-
|
11 |
# Pre-configured settings (no user input)
|
12 |
system_message = "You are an ATS Score analyzer. Provide clear and constructive feedback to improve the ATS score."
|
13 |
selected_model = "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" # Example model
|
14 |
max_tokens = 100
|
15 |
-
temperature = 0.
|
16 |
top_p = 0.6
|
17 |
|
18 |
# Function to query the Hugging Face API
|
@@ -32,16 +30,12 @@ def modelFeedback(ats_score, resume_data, job_description):
|
|
32 |
"""
|
33 |
Generate ATS feedback using a pre-configured model pipeline.
|
34 |
"""
|
35 |
-
# Set up the model for SentenceTransformer
|
36 |
-
model = SentenceTransformer('paraphrase-MiniLM-L6-v2')
|
37 |
-
|
38 |
# Prepare the input prompt
|
39 |
input_prompt = f"""
|
40 |
You are now an ATS Score analyzer and given ATS Score is {int(ats_score * 100)}%.
|
41 |
Your task is to provide a comprehensive review and feedback based on the ATS score.
|
42 |
-
|
43 |
### ATS Score:
|
44 |
-
The current ATS score is {int(ats_score * 100)}%. Your goal is to increase this score by aligning the resume more closely with the job description. This is the model I am using "
|
45 |
|
46 |
### Overall Resume Review:
|
47 |
Please assess the following key aspects of the resume and provide specific feedback where necessary. In each case, suggest improvements, if any:
|
@@ -56,7 +50,6 @@ def modelFeedback(ats_score, resume_data, job_description):
|
|
56 |
|
57 |
### Matching with Job Description:
|
58 |
Now, focus on matching the resume with the job description. Provide detailed feedback on how well the resume aligns with the job description and where it falls short. Suggest specific content that needs to be replaced, added, or modified to improve the ATS score.
|
59 |
-
|
60 |
#### Resume Data: {resume_data}
|
61 |
#### Job Description: {job_description}
|
62 |
"""
|
@@ -90,4 +83,4 @@ def modelFeedback(ats_score, resume_data, job_description):
|
|
90 |
return "Error: Unexpected response from the model. Please try again."
|
91 |
else:
|
92 |
logger.error(f"Empty or invalid API response: {output}")
|
93 |
-
return "Error: Unable to generate a response. Please check the model and try again."
|
|
|
1 |
import streamlit as st
|
2 |
import requests
|
3 |
import logging
|
|
|
4 |
|
5 |
# Configure logging
|
6 |
logging.basicConfig(level=logging.INFO)
|
7 |
logger = logging.getLogger(__name__)
|
8 |
|
|
|
9 |
# Pre-configured settings (no user input)
|
10 |
system_message = "You are an ATS Score analyzer. Provide clear and constructive feedback to improve the ATS score."
|
11 |
selected_model = "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" # Example model
|
12 |
max_tokens = 100
|
13 |
+
temperature = 0.1
|
14 |
top_p = 0.6
|
15 |
|
16 |
# Function to query the Hugging Face API
|
|
|
30 |
"""
|
31 |
Generate ATS feedback using a pre-configured model pipeline.
|
32 |
"""
|
|
|
|
|
|
|
33 |
# Prepare the input prompt
|
34 |
input_prompt = f"""
|
35 |
You are now an ATS Score analyzer and given ATS Score is {int(ats_score * 100)}%.
|
36 |
Your task is to provide a comprehensive review and feedback based on the ATS score.
|
|
|
37 |
### ATS Score:
|
38 |
+
The current ATS score is {int(ats_score * 100)}%. Your goal is to increase this score by aligning the resume more closely with the job description. This is the model I am using "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B" so make sure the ats score improvements are based on this model.
|
39 |
|
40 |
### Overall Resume Review:
|
41 |
Please assess the following key aspects of the resume and provide specific feedback where necessary. In each case, suggest improvements, if any:
|
|
|
50 |
|
51 |
### Matching with Job Description:
|
52 |
Now, focus on matching the resume with the job description. Provide detailed feedback on how well the resume aligns with the job description and where it falls short. Suggest specific content that needs to be replaced, added, or modified to improve the ATS score.
|
|
|
53 |
#### Resume Data: {resume_data}
|
54 |
#### Job Description: {job_description}
|
55 |
"""
|
|
|
83 |
return "Error: Unexpected response from the model. Please try again."
|
84 |
else:
|
85 |
logger.error(f"Empty or invalid API response: {output}")
|
86 |
+
return "Error: Unable to generate a response. Please check the model and try again."
|