Spaces:
Configuration error
Configuration error
Refactored check for pre-existing linked profile PDF
Browse files- functions/gradio.py +8 -23
- functions/linkedin_resume.py +15 -0
functions/gradio.py
CHANGED
@@ -7,7 +7,7 @@ Functions for handling Gradio UI interactions and processing user inputs.
|
|
7 |
import logging
|
8 |
import shutil
|
9 |
from pathlib import Path
|
10 |
-
from functions.linkedin_resume import extract_text_from_linkedin_pdf
|
11 |
from functions.github import get_github_repositories
|
12 |
from functions.job_call import summarize_job_call
|
13 |
from functions.writer_agent import write_resume
|
@@ -20,28 +20,6 @@ logging.basicConfig(level=logging.INFO)
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
|
22 |
|
23 |
-
class MockFile:
|
24 |
-
"""Mock file object that mimics uploaded file interface with just a file path."""
|
25 |
-
|
26 |
-
def __init__(self, path):
|
27 |
-
self.name = path
|
28 |
-
|
29 |
-
|
30 |
-
def check_default_linkedin_pdf():
|
31 |
-
"""Check if default LinkedIn PDF exists in data directory."""
|
32 |
-
|
33 |
-
# Get the project root directory (parent of functions directory)
|
34 |
-
project_root = Path(__file__).parent.parent
|
35 |
-
default_pdf = f'{project_root}/data/linkedin_profile.pdf'
|
36 |
-
|
37 |
-
if not Path(default_pdf).exists():
|
38 |
-
logger.warning("Default LinkedIn PDF not found at %s", default_pdf)
|
39 |
-
|
40 |
-
return False, None
|
41 |
-
|
42 |
-
return True, default_pdf
|
43 |
-
|
44 |
-
|
45 |
def process_with_default_option(
|
46 |
use_default_pdf,
|
47 |
linkedin_pdf,
|
@@ -254,3 +232,10 @@ def get_processed_data(linkedin_pdf, github_url, job_post_text, instructions):
|
|
254 |
processed_data["errors"].append(f"GitHub: {github_result['message']}")
|
255 |
|
256 |
return processed_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
import logging
|
8 |
import shutil
|
9 |
from pathlib import Path
|
10 |
+
from functions.linkedin_resume import extract_text_from_linkedin_pdf, check_default_linkedin_pdf
|
11 |
from functions.github import get_github_repositories
|
12 |
from functions.job_call import summarize_job_call
|
13 |
from functions.writer_agent import write_resume
|
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def process_with_default_option(
|
24 |
use_default_pdf,
|
25 |
linkedin_pdf,
|
|
|
232 |
processed_data["errors"].append(f"GitHub: {github_result['message']}")
|
233 |
|
234 |
return processed_data
|
235 |
+
|
236 |
+
|
237 |
+
class MockFile:
|
238 |
+
"""Mock file object that mimics uploaded file interface with just a file path."""
|
239 |
+
|
240 |
+
def __init__(self, path):
|
241 |
+
self.name = path
|
functions/linkedin_resume.py
CHANGED
@@ -20,6 +20,21 @@ logging.basicConfig(level=logging.INFO)
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def extract_text_from_linkedin_pdf(pdf_file) -> dict:
|
24 |
"""
|
25 |
Extract and structure text content from an uploaded LinkedIn resume export PDF file
|
|
|
20 |
logger = logging.getLogger(__name__)
|
21 |
|
22 |
|
23 |
+
def check_default_linkedin_pdf():
|
24 |
+
"""Check if default LinkedIn PDF exists in data directory."""
|
25 |
+
|
26 |
+
# Get the project root directory (parent of functions directory)
|
27 |
+
project_root = Path(__file__).parent.parent
|
28 |
+
default_pdf = f'{project_root}/data/linkedin_profile.pdf'
|
29 |
+
|
30 |
+
if not Path(default_pdf).exists():
|
31 |
+
logger.warning("Default LinkedIn PDF not found at %s", default_pdf)
|
32 |
+
|
33 |
+
return False, None
|
34 |
+
|
35 |
+
return True, default_pdf
|
36 |
+
|
37 |
+
|
38 |
def extract_text_from_linkedin_pdf(pdf_file) -> dict:
|
39 |
"""
|
40 |
Extract and structure text content from an uploaded LinkedIn resume export PDF file
|