Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import fitz
|
| 3 |
-
import docx
|
| 4 |
from sentence_transformers import SentenceTransformer, util
|
| 5 |
from gtts import gTTS
|
| 6 |
import tempfile
|
|
@@ -8,7 +8,6 @@ import tempfile
|
|
| 8 |
# Load model
|
| 9 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|
| 10 |
|
| 11 |
-
# Skills list
|
| 12 |
top_skills = [
|
| 13 |
"Python", "Java", "C++", "SQL", "JavaScript", "React", "Node.js",
|
| 14 |
"Machine Learning", "Data Analysis", "Excel", "Communication",
|
|
@@ -28,8 +27,6 @@ def extract_text_from_docx(docx_file):
|
|
| 28 |
return "\n".join([p.text for p in doc.paragraphs])
|
| 29 |
|
| 30 |
def summarize_resume(text):
|
| 31 |
-
# Placeholder LLM summary
|
| 32 |
-
# Replace with actual LLM API call if needed
|
| 33 |
summary = "This resume highlights skills in " + ", ".join(list(set(analyze_resume(text)[0].split(", ")))) + "."
|
| 34 |
return summary
|
| 35 |
|
|
@@ -122,22 +119,53 @@ def process_resume(file_obj):
|
|
| 122 |
|
| 123 |
return resume_text, summary, skills, jobs, missing, f"{score}/100", report_path, audio_path
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
|
| 142 |
if __name__ == "__main__":
|
| 143 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import fitz
|
| 3 |
+
import docx
|
| 4 |
from sentence_transformers import SentenceTransformer, util
|
| 5 |
from gtts import gTTS
|
| 6 |
import tempfile
|
|
|
|
| 8 |
# Load model
|
| 9 |
model = SentenceTransformer("all-MiniLM-L6-v2")
|
| 10 |
|
|
|
|
| 11 |
top_skills = [
|
| 12 |
"Python", "Java", "C++", "SQL", "JavaScript", "React", "Node.js",
|
| 13 |
"Machine Learning", "Data Analysis", "Excel", "Communication",
|
|
|
|
| 27 |
return "\n".join([p.text for p in doc.paragraphs])
|
| 28 |
|
| 29 |
def summarize_resume(text):
|
|
|
|
|
|
|
| 30 |
summary = "This resume highlights skills in " + ", ".join(list(set(analyze_resume(text)[0].split(", ")))) + "."
|
| 31 |
return summary
|
| 32 |
|
|
|
|
| 119 |
|
| 120 |
return resume_text, summary, skills, jobs, missing, f"{score}/100", report_path, audio_path
|
| 121 |
|
| 122 |
+
# Build the UI
|
| 123 |
+
with gr.Blocks(theme="soft") as demo:
|
| 124 |
+
gr.Markdown("""
|
| 125 |
+
# πβ¨ Resume Analyzer & Job Matcher
|
| 126 |
+
Upload your **resume** and let AI analyze it for:
|
| 127 |
+
- π§ Summary of your profile
|
| 128 |
+
- β
Detected skills
|
| 129 |
+
- πΌ Suggested job titles
|
| 130 |
+
- π Recommended skills to learn
|
| 131 |
+
- π― Resume score
|
| 132 |
+
- π Audio feedback
|
| 133 |
+
- π Downloadable report
|
| 134 |
+
|
| 135 |
+
Supported formats: `.pdf`, `.docx`, `.txt`
|
| 136 |
+
""")
|
| 137 |
+
|
| 138 |
+
with gr.Row():
|
| 139 |
+
with gr.Column():
|
| 140 |
+
file = gr.File(label="π€ Upload your resume here")
|
| 141 |
+
btn = gr.Button("π Analyze Resume")
|
| 142 |
+
|
| 143 |
+
with gr.Tabs():
|
| 144 |
+
with gr.Tab("π Resume Text"):
|
| 145 |
+
resume_text = gr.Textbox(label="Your Resume Text", lines=15, interactive=False)
|
| 146 |
+
|
| 147 |
+
with gr.Tab("π§ Summary"):
|
| 148 |
+
summary = gr.Textbox(label="Resume Summary", interactive=False)
|
| 149 |
+
|
| 150 |
+
with gr.Tab("π§° Skills & Jobs"):
|
| 151 |
+
skills = gr.Textbox(label="Detected Skills", interactive=False)
|
| 152 |
+
jobs = gr.Textbox(label="Suggested Job Titles", interactive=False)
|
| 153 |
+
missing = gr.Textbox(label="Recommended Skills to Learn", interactive=False)
|
| 154 |
+
|
| 155 |
+
with gr.Tab("π Score"):
|
| 156 |
+
score = gr.Textbox(label="Resume Score", interactive=False)
|
| 157 |
+
|
| 158 |
+
with gr.Tab("π Download & π Audio"):
|
| 159 |
+
report = gr.File(label="π Download Analysis Report")
|
| 160 |
+
audio = gr.Audio(label="π Job Titles Audio")
|
| 161 |
+
|
| 162 |
+
btn.click(
|
| 163 |
+
fn=process_resume,
|
| 164 |
+
inputs=file,
|
| 165 |
+
outputs=[
|
| 166 |
+
resume_text, summary, skills, jobs, missing, score, report, audio
|
| 167 |
+
]
|
| 168 |
+
)
|
| 169 |
|
| 170 |
if __name__ == "__main__":
|
| 171 |
demo.launch()
|