Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,18 +56,26 @@ def analyze_documents(resume_text, job_description):
|
|
| 56 |
]
|
| 57 |
}
|
| 58 |
response = requests.post(url, headers=headers, json=data)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
return response.json()
|
| 60 |
|
| 61 |
def extract_match_percentage(response):
|
| 62 |
"""Extract match percentage from API response with additional checks."""
|
| 63 |
try:
|
|
|
|
| 64 |
analysis_content = response.get("choices", [{}])[0].get("text", "")
|
|
|
|
|
|
|
| 65 |
match_percentage = None
|
| 66 |
|
| 67 |
-
#
|
| 68 |
for line in analysis_content.split("\n"):
|
|
|
|
| 69 |
if "match percentage" in line.lower():
|
| 70 |
-
#
|
| 71 |
percentage_str = ''.join(filter(str.isdigit, line.split(":")[-1].strip()))
|
| 72 |
if percentage_str:
|
| 73 |
match_percentage = int(percentage_str)
|
|
|
|
| 56 |
]
|
| 57 |
}
|
| 58 |
response = requests.post(url, headers=headers, json=data)
|
| 59 |
+
|
| 60 |
+
# Debugging: Log the raw API response to check the structure
|
| 61 |
+
st.write(f"Raw API Response: {response.json()}") # Debugging the API response
|
| 62 |
+
|
| 63 |
return response.json()
|
| 64 |
|
| 65 |
def extract_match_percentage(response):
|
| 66 |
"""Extract match percentage from API response with additional checks."""
|
| 67 |
try:
|
| 68 |
+
# Debugging: Check the structure of the response
|
| 69 |
analysis_content = response.get("choices", [{}])[0].get("text", "")
|
| 70 |
+
st.write(f"Analysis Content: {analysis_content}") # Debugging the analysis content
|
| 71 |
+
|
| 72 |
match_percentage = None
|
| 73 |
|
| 74 |
+
# Look for match percentage in the analysis content
|
| 75 |
for line in analysis_content.split("\n"):
|
| 76 |
+
st.write(f"Line: {line}") # Debugging each line
|
| 77 |
if "match percentage" in line.lower():
|
| 78 |
+
# Extract numeric percentage from the line
|
| 79 |
percentage_str = ''.join(filter(str.isdigit, line.split(":")[-1].strip()))
|
| 80 |
if percentage_str:
|
| 81 |
match_percentage = int(percentage_str)
|