Spaces:
Configuration error
Configuration error
Added text cleanup
Browse files- functions/gradio.py +17 -17
- functions/job_call.py +7 -2
functions/gradio.py
CHANGED
@@ -60,29 +60,29 @@ def process_inputs(
|
|
60 |
logger.info("User instructions: %s", user_instructions[:100] if user_instructions else "None")
|
61 |
result = ""
|
62 |
|
63 |
-
# ==================================================================== #
|
64 |
-
# Extract and structure text from the linkedin profile PDF
|
65 |
-
logger.info("Extracting text from LinkedIn PDF: %s", linkedin_pdf_path)
|
66 |
-
linkedin_resume = extract_text(linkedin_pdf_path)
|
67 |
|
68 |
-
if linkedin_resume:
|
69 |
-
|
70 |
|
71 |
-
else:
|
72 |
-
|
73 |
|
74 |
-
# ==================================================================== #
|
75 |
-
# Process GitHub profile
|
76 |
-
logger.info("Processing GitHub profile: %s", github_username.strip())
|
77 |
|
78 |
-
# Retrieve repositories from GitHub
|
79 |
-
github_repositories = get_github_repositories(github_username.strip())
|
80 |
|
81 |
-
if github_repositories:
|
82 |
-
|
83 |
|
84 |
-
else:
|
85 |
-
|
86 |
|
87 |
# ==================================================================== #
|
88 |
# Process job post text
|
|
|
60 |
logger.info("User instructions: %s", user_instructions[:100] if user_instructions else "None")
|
61 |
result = ""
|
62 |
|
63 |
+
# # ==================================================================== #
|
64 |
+
# # Extract and structure text from the linkedin profile PDF
|
65 |
+
# logger.info("Extracting text from LinkedIn PDF: %s", linkedin_pdf_path)
|
66 |
+
# linkedin_resume = extract_text(linkedin_pdf_path)
|
67 |
|
68 |
+
# if linkedin_resume:
|
69 |
+
# logger.info("LinkedIn PDF text extraction successful")
|
70 |
|
71 |
+
# else:
|
72 |
+
# logger.error("LinkedIn PDF text extraction failed")
|
73 |
|
74 |
+
# # ==================================================================== #
|
75 |
+
# # Process GitHub profile
|
76 |
+
# logger.info("Processing GitHub profile: %s", github_username.strip())
|
77 |
|
78 |
+
# # Retrieve repositories from GitHub
|
79 |
+
# github_repositories = get_github_repositories(github_username.strip())
|
80 |
|
81 |
+
# if github_repositories:
|
82 |
+
# logger.info("GitHub repositories retrieved successfully")
|
83 |
|
84 |
+
# else:
|
85 |
+
# logger.error("GitHub repositories retrieval failed")
|
86 |
|
87 |
# ==================================================================== #
|
88 |
# Process job post text
|
functions/job_call.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
import os
|
4 |
import json
|
5 |
import logging
|
|
|
6 |
from pathlib import Path
|
7 |
from datetime import datetime
|
8 |
from openai import OpenAI
|
@@ -12,6 +13,8 @@ from configuration import (
|
|
12 |
JOB_CALL_EXTRACTION_PROMPT
|
13 |
)
|
14 |
|
|
|
|
|
15 |
# pylint: disable=broad-exception-caught
|
16 |
|
17 |
|
@@ -27,6 +30,9 @@ def summarize_job_call(job_call: str) -> str:
|
|
27 |
|
28 |
logger = logging.getLogger(f'{__name__}.summarize_job_call')
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
client = OpenAI(
|
32 |
base_url=INFERENCE_URL,
|
@@ -49,8 +55,6 @@ def summarize_job_call(job_call: str) -> str:
|
|
49 |
'messages': messages,
|
50 |
}
|
51 |
|
52 |
-
print(completion_args)
|
53 |
-
|
54 |
try:
|
55 |
response = client.chat.completions.create(**completion_args)
|
56 |
|
@@ -63,6 +67,7 @@ def summarize_job_call(job_call: str) -> str:
|
|
63 |
|
64 |
try:
|
65 |
summary = json.loads(summary)
|
|
|
66 |
|
67 |
except json.JSONDecodeError as e:
|
68 |
logger.error("Failed to parse job call summary JSON: %s", e)
|
|
|
3 |
import os
|
4 |
import json
|
5 |
import logging
|
6 |
+
import unicodedata
|
7 |
from pathlib import Path
|
8 |
from datetime import datetime
|
9 |
from openai import OpenAI
|
|
|
13 |
JOB_CALL_EXTRACTION_PROMPT
|
14 |
)
|
15 |
|
16 |
+
from functions.helper import clean_text_whitespace
|
17 |
+
|
18 |
# pylint: disable=broad-exception-caught
|
19 |
|
20 |
|
|
|
30 |
|
31 |
logger = logging.getLogger(f'{__name__}.summarize_job_call')
|
32 |
|
33 |
+
# Clean up the job call text
|
34 |
+
job_call = unicodedata.normalize('NFKC', job_call)
|
35 |
+
job_call = clean_text_whitespace(job_call)
|
36 |
|
37 |
client = OpenAI(
|
38 |
base_url=INFERENCE_URL,
|
|
|
55 |
'messages': messages,
|
56 |
}
|
57 |
|
|
|
|
|
58 |
try:
|
59 |
response = client.chat.completions.create(**completion_args)
|
60 |
|
|
|
67 |
|
68 |
try:
|
69 |
summary = json.loads(summary)
|
70 |
+
print(summary.keys())
|
71 |
|
72 |
except json.JSONDecodeError as e:
|
73 |
logger.error("Failed to parse job call summary JSON: %s", e)
|