Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import PyPDF2
|
| 3 |
import io
|
| 4 |
-
import re
|
| 5 |
import json
|
| 6 |
-
import os
|
| 7 |
-
from huggingface_hub import login
|
| 8 |
from dotenv import load_dotenv
|
|
|
|
| 9 |
|
| 10 |
# --- Configuration --- #
|
| 11 |
load_dotenv()
|
|
@@ -27,12 +25,11 @@ def extract_text_from_pdf(pdf_file):
|
|
| 27 |
|
| 28 |
def generate_ai_prompt(resume_text, job_desc=None):
|
| 29 |
"""Generates smart analysis prompt for AI"""
|
|
|
|
| 30 |
return f"""
|
| 31 |
Analyze this resume comprehensively:
|
| 32 |
{resume_text[:10000]}
|
| 33 |
-
|
| 34 |
-
{f"Compare against this job description: {job_desc[:2000]}" if job_desc else ""}
|
| 35 |
-
|
| 36 |
Return JSON with:
|
| 37 |
{{
|
| 38 |
"score": 0-100 (overall quality),
|
|
@@ -47,7 +44,7 @@ def generate_ai_prompt(resume_text, job_desc=None):
|
|
| 47 |
"detected_skills": ["list", "of", "skills", "with", "variants"],
|
| 48 |
"strengths": ["list", "of", "2-3", "key", "strengths"],
|
| 49 |
"improvements": ["3-5", "specific", "actionable", "suggestions"],
|
| 50 |
-
"missing_keywords": ["important", "missing", "terms"]
|
| 51 |
}}
|
| 52 |
"""
|
| 53 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import PyPDF2
|
| 3 |
import io
|
|
|
|
| 4 |
import json
|
|
|
|
|
|
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
+
from huggingface_hub import login
|
| 7 |
|
| 8 |
# --- Configuration --- #
|
| 9 |
load_dotenv()
|
|
|
|
| 25 |
|
| 26 |
def generate_ai_prompt(resume_text, job_desc=None):
|
| 27 |
"""Generates smart analysis prompt for AI"""
|
| 28 |
+
job_desc_part = f"\nCompare against this job description: {job_desc[:2000]}" if job_desc else ""
|
| 29 |
return f"""
|
| 30 |
Analyze this resume comprehensively:
|
| 31 |
{resume_text[:10000]}
|
| 32 |
+
{job_desc_part}
|
|
|
|
|
|
|
| 33 |
Return JSON with:
|
| 34 |
{{
|
| 35 |
"score": 0-100 (overall quality),
|
|
|
|
| 44 |
"detected_skills": ["list", "of", "skills", "with", "variants"],
|
| 45 |
"strengths": ["list", "of", "2-3", "key", "strengths"],
|
| 46 |
"improvements": ["3-5", "specific", "actionable", "suggestions"],
|
| 47 |
+
"missing_keywords": ["important", "missing", "terms"]{" if job_desc else ""}
|
| 48 |
}}
|
| 49 |
"""
|
| 50 |
|