zarashahid commited on
Commit
3632434
Β·
verified Β·
1 Parent(s): e3566d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -21
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
- import fitz # PyMuPDF for PDF
3
- import docx # python-docx for 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
- demo = gr.Interface(
126
- fn=process_resume,
127
- inputs=gr.File(label="Upload your resume (.pdf, .txt, .docx)"),
128
- outputs=[
129
- gr.Textbox(label="Resume Text", lines=10),
130
- gr.Textbox(label="Resume Summary"),
131
- gr.Textbox(label="Detected Skills"),
132
- gr.Textbox(label="Suggested Job Titles"),
133
- gr.Textbox(label="Recommended Skills to Learn"),
134
- gr.Textbox(label="Resume Score"),
135
- gr.File(label="Download Analysis Report"),
136
- gr.Audio(label="Job Titles Audio")
137
- ],
138
- title="Resume Analyzer & Job Matcher",
139
- description="Upload a PDF, DOCX, or text resume to get summary, job suggestions, skill feedback, score, and even audio suggestions!"
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()