File size: 28,769 Bytes
07a270b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get The text from the PDF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting pdfplumber\n",
      "  Downloading pdfplumber-0.11.6-py3-none-any.whl.metadata (42 kB)\n",
      "     ---------------------------------------- 0.0/42.8 kB ? eta -:--:--\n",
      "     --------- ------------------------------ 10.2/42.8 kB ? eta -:--:--\n",
      "     --------- ------------------------------ 10.2/42.8 kB ? eta -:--:--\n",
      "     ------------------ -------------------- 20.5/42.8 kB 93.1 kB/s eta 0:00:01\n",
      "     ------------------ -------------------- 20.5/42.8 kB 93.1 kB/s eta 0:00:01\n",
      "     --------------------------- ---------- 30.7/42.8 kB 119.1 kB/s eta 0:00:01\n",
      "     -------------------------------------- 42.8/42.8 kB 138.4 kB/s eta 0:00:00\n",
      "Collecting pytesseract\n",
      "  Downloading pytesseract-0.3.13-py3-none-any.whl.metadata (11 kB)\n",
      "Collecting pdf2image\n",
      "  Downloading pdf2image-1.17.0-py3-none-any.whl.metadata (6.2 kB)\n",
      "Collecting pdfminer.six==20250327 (from pdfplumber)\n",
      "  Downloading pdfminer_six-20250327-py3-none-any.whl.metadata (4.1 kB)\n",
      "Requirement already satisfied: Pillow>=9.1 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pdfplumber) (10.3.0)\n",
      "Collecting pypdfium2>=4.18.0 (from pdfplumber)\n",
      "  Using cached pypdfium2-4.30.1-py3-none-win_amd64.whl.metadata (48 kB)\n",
      "Requirement already satisfied: charset-normalizer>=2.0.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pdfminer.six==20250327->pdfplumber) (3.3.2)\n",
      "Collecting cryptography>=36.0.0 (from pdfminer.six==20250327->pdfplumber)\n",
      "  Using cached cryptography-44.0.2-cp39-abi3-win_amd64.whl.metadata (5.7 kB)\n",
      "Requirement already satisfied: packaging>=21.3 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pytesseract) (23.2)\n",
      "Requirement already satisfied: cffi>=1.12 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from cryptography>=36.0.0->pdfminer.six==20250327->pdfplumber) (1.16.0)\n",
      "Requirement already satisfied: pycparser in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from cffi>=1.12->cryptography>=36.0.0->pdfminer.six==20250327->pdfplumber) (2.22)\n",
      "Downloading pdfplumber-0.11.6-py3-none-any.whl (60 kB)\n",
      "   ---------------------------------------- 0.0/60.2 kB ? eta -:--:--\n",
      "   ---------------------------------- ----- 51.2/60.2 kB 1.3 MB/s eta 0:00:01\n",
      "   ---------------------------------------- 60.2/60.2 kB 793.5 kB/s eta 0:00:00\n",
      "Downloading pdfminer_six-20250327-py3-none-any.whl (5.6 MB)\n",
      "   ---------------------------------------- 0.0/5.6 MB ? eta -:--:--\n",
      "    --------------------------------------- 0.1/5.6 MB 3.5 MB/s eta 0:00:02\n",
      "   ----- ---------------------------------- 0.7/5.6 MB 7.8 MB/s eta 0:00:01\n",
      "   ------------ --------------------------- 1.7/5.6 MB 12.1 MB/s eta 0:00:01\n",
      "   ---------------- ----------------------- 2.3/5.6 MB 12.3 MB/s eta 0:00:01\n",
      "   -------------------------- ------------- 3.7/5.6 MB 15.8 MB/s eta 0:00:01\n",
      "   ---------------------------------- ----- 4.8/5.6 MB 16.3 MB/s eta 0:00:01\n",
      "   -------------------------------------- - 5.4/5.6 MB 15.8 MB/s eta 0:00:01\n",
      "   ---------------------------------------  5.6/5.6 MB 15.6 MB/s eta 0:00:01\n",
      "   ---------------------------------------- 5.6/5.6 MB 13.3 MB/s eta 0:00:00\n",
      "Downloading pytesseract-0.3.13-py3-none-any.whl (14 kB)\n",
      "Downloading pdf2image-1.17.0-py3-none-any.whl (11 kB)\n",
      "Using cached pypdfium2-4.30.1-py3-none-win_amd64.whl (3.0 MB)\n",
      "Using cached cryptography-44.0.2-cp39-abi3-win_amd64.whl (3.2 MB)\n",
      "Installing collected packages: pytesseract, pypdfium2, pdf2image, cryptography, pdfminer.six, pdfplumber\n",
      "Successfully installed cryptography-44.0.2 pdf2image-1.17.0 pdfminer.six-20250327 pdfplumber-0.11.6 pypdfium2-4.30.1 pytesseract-0.3.13\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "[notice] A new release of pip is available: 24.0 -> 25.0.1\n",
      "[notice] To update, run: python.exe -m pip install --upgrade pip\n"
     ]
    }
   ],
   "source": [
    "%pip install pdfplumber pytesseract pdf2image"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pdfplumber\n",
    "import pytesseract\n",
    "from pdf2image import convert_from_path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "def extract_text_from_pdf(pdf_path):\n",
    "    text = \"\"\n",
    "    try:\n",
    "        # Try direct text extraction\n",
    "        with pdfplumber.open(pdf_path) as pdf:\n",
    "            for page in pdf.pages:\n",
    "                page_text = page.extract_text()\n",
    "                if page_text:\n",
    "                    text += page_text\n",
    "\n",
    "        if text.strip():\n",
    "            return text.strip()\n",
    "    except Exception as e:\n",
    "        print(f\"Direct text extraction failed: {e}\")\n",
    "\n",
    "    # Fallback to OCR for image-based PDFs\n",
    "    print(\"Falling back to OCR for image-based PDF.\")\n",
    "    try:\n",
    "        images = convert_from_path(pdf_path)\n",
    "        for image in images:\n",
    "            page_text = pytesseract.image_to_string(image)\n",
    "            text += page_text + \"\\n\"\n",
    "    except Exception as e:\n",
    "        print(f\"OCR failed: {e}\")\n",
    "\n",
    "    return text.strip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "CropBox missing from /Page, defaulting to MediaBox\n",
      "CropBox missing from /Page, defaulting to MediaBox\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Extracted Text from PDF:\n",
      "MAX JOHNSON\n",
      "Mumbai, India | maxjohnson1209@gmail.com |+91-7039314886 | linkedin.com/in/maxjohnson-1209/\n",
      "EXPERIENCE\n",
      "Oracle Financial Services Software Limited | Associate Consultant Mumbai, MH, India| July 2023 - Present\n",
      "• Creating tailored pitch decks, brochures, and solution overviews for client engagements, ensuring alignment with market\n",
      "trends and customer requirements.\n",
      "• Collaborating with cross-functional teams to define and execute GTM strategies, including market research, segmentation.\n",
      "• Skills- OCI, Python, Gen-AI, Agile Methodology, Content Packaging, Confluence, GTM Strategy.\n",
      "Fractal | Partner & Alliance Intern Mumbai, MH, India | Aug 2022 – March 2023\n",
      "• Worked as web designer & Fractal core team to create Google Cloud microsite focusing Fractal & Google Cloud 360* strategic\n",
      "partnership to generate inbound leads.\n",
      "• Executed GTM Strategy for Google Cloud India Business and Demand Generation Plans.\n",
      "• Worked jointly with the marketing team to create a brand factor for Google Cloud and fractal in the Indian Market.\n",
      "• Handled top-line existing accounts with an aim to grow and strengthen the customer relationship ahead.\n",
      "Zee Entertainment Private Limited | Project Management Intern Mumbai, MH, India| Dec 2021 – Feb 2022\n",
      "• Worked and managed on special project (Mind wars 2.0) with core team to analyze the Market Needs.\n",
      "• Worked on requirements gathering, maintain proper project plan and executing.\n",
      "• Owned & executed the project on Jira tool, scheduling and work plan.\n",
      "• Worked with core team in collaborating & strategy planning with CSR Institutes\n",
      "SKILLS\n",
      "• Tech Stack: Python, Pandas, Streamlit.\n",
      "• Product Management Tools: Jira, Asana, Zoho, Confluence, Figma.\n",
      "• Cloud: Google Cloud (GCP), Oracle Cloud Infrastructure (OCI).\n",
      "• AI/ML: Lang chain, Open AI, Google AI-Studio, Hugging Face.\n",
      "PROJECTS\n",
      "Document Genie – Insight Bot\n",
      "• Document Genie is a powerful Stream lit application designed to extract and analyze text from PDF documents.\n",
      "• Utilizes Google's Generative AI model Gemini-PRO for high-quality, contextually relevant answers.\n",
      "• Developed an LLM-based Q&A system using Google Palm LLM, Hugging Face embeddings, Lang Chain, Streamlit\n",
      "Fin Sight – Finance News Research Tool\n",
      "• Users can input article URLs and ask questions to receive relevant insights from the stock market and financial domain.\n",
      "• Process article content through Lang Chain’s Unstructured URL Loader, Interact with the LLM's Open AI – ChatGPT\n",
      "• Utilized Lang Chain for content processing, OpenAI for embeddings and FAISS for effective information retrieval,\n",
      "enabling interaction with ChatGPT for queries and answers along with source URLs\n",
      "EDUCATION\n",
      "Bachelor of Engineering, Electronics & Computer Science May 2023\n",
      "Fr. Conceicao Rodrigues College of Engineering - University of Mumbai CGPA: 9.2/10\n",
      "Relevant Coursework: Foundations of Artificial Intelligence/ML, Project Management, Management Information System\n",
      "CERTIFICATIONS\n",
      "• Oracle Cloud Infrastructure 2024 – Foundation Associate | Oracle University\n",
      "• Oracle Cloud Infrastructure 2024 Generative AI Professional| Oracle University\n",
      "• Oracle Database SQL Associate Certified | Oracle University\n",
      "• Oracle Cloud Infrastructure Artificial Intelligence Foundation 2024| Oracle University\n",
      "• Generative AI For Everyone | DeepLearning.ai\n",
      "• Certified SAF’e Agilist & Product Owner\n"
     ]
    }
   ],
   "source": [
    "pdf_path = \"Resume.pdf\"\n",
    "resume_text = extract_text_from_pdf(pdf_path)\n",
    "\n",
    "print(\"\\nExtracted Text from PDF:\")\n",
    "print(resume_text)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set Google GenerativeAI Api Key"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: google.generativeai in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (0.8.4)\n",
      "Requirement already satisfied: python-dotenv in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (1.1.0)\n",
      "Requirement already satisfied: google-ai-generativelanguage==0.6.15 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (0.6.15)\n",
      "Requirement already satisfied: google-api-core in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (2.24.2)\n",
      "Requirement already satisfied: google-api-python-client in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (2.166.0)\n",
      "Requirement already satisfied: google-auth>=2.15.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (2.38.0)\n",
      "Requirement already satisfied: protobuf in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (5.29.4)\n",
      "Requirement already satisfied: pydantic in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (2.7.1)\n",
      "Requirement already satisfied: tqdm in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (4.67.1)\n",
      "Requirement already satisfied: typing-extensions in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google.generativeai) (4.11.0)\n",
      "Requirement already satisfied: proto-plus<2.0.0dev,>=1.22.3 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-ai-generativelanguage==0.6.15->google.generativeai) (1.26.1)\n",
      "Requirement already satisfied: googleapis-common-protos<2.0.0,>=1.56.2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-core->google.generativeai) (1.69.2)\n",
      "Requirement already satisfied: requests<3.0.0,>=2.18.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-core->google.generativeai) (2.31.0)\n",
      "Requirement already satisfied: cachetools<6.0,>=2.0.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-auth>=2.15.0->google.generativeai) (5.3.3)\n",
      "Requirement already satisfied: pyasn1-modules>=0.2.1 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-auth>=2.15.0->google.generativeai) (0.4.2)\n",
      "Requirement already satisfied: rsa<5,>=3.1.4 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-auth>=2.15.0->google.generativeai) (4.9)\n",
      "Requirement already satisfied: httplib2<1.0.0,>=0.19.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-python-client->google.generativeai) (0.22.0)\n",
      "Requirement already satisfied: google-auth-httplib2<1.0.0,>=0.2.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-python-client->google.generativeai) (0.2.0)\n",
      "Requirement already satisfied: uritemplate<5,>=3.0.1 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-python-client->google.generativeai) (4.1.1)\n",
      "Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pydantic->google.generativeai) (0.6.0)\n",
      "Requirement already satisfied: pydantic-core==2.18.2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pydantic->google.generativeai) (2.18.2)\n",
      "Requirement already satisfied: colorama in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from tqdm->google.generativeai) (0.4.6)\n",
      "Requirement already satisfied: grpcio<2.0dev,>=1.33.2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1->google-ai-generativelanguage==0.6.15->google.generativeai) (1.71.0)\n",
      "Requirement already satisfied: grpcio-status<2.0.dev0,>=1.33.2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.10.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,<3.0.0dev,>=1.34.1->google-ai-generativelanguage==0.6.15->google.generativeai) (1.71.0)\n",
      "Requirement already satisfied: pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from httplib2<1.0.0,>=0.19.0->google-api-python-client->google.generativeai) (3.2.3)\n",
      "Requirement already satisfied: pyasn1<0.7.0,>=0.6.1 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from pyasn1-modules>=0.2.1->google-auth>=2.15.0->google.generativeai) (0.6.1)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests<3.0.0,>=2.18.0->google-api-core->google.generativeai) (3.3.2)\n",
      "Requirement already satisfied: idna<4,>=2.5 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests<3.0.0,>=2.18.0->google-api-core->google.generativeai) (3.7)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests<3.0.0,>=2.18.0->google-api-core->google.generativeai) (2.2.1)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\andre\\appdata\\local\\programs\\python\\python312\\lib\\site-packages (from requests<3.0.0,>=2.18.0->google-api-core->google.generativeai) (2024.2.2)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "[notice] A new release of pip is available: 24.0 -> 25.0.1\n",
      "[notice] To update, run: python.exe -m pip install --upgrade pip\n"
     ]
    }
   ],
   "source": [
    "%pip install google.generativeai python-dotenv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "c:\\Users\\Andre\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
      "  from .autonotebook import tqdm as notebook_tqdm\n"
     ]
    }
   ],
   "source": [
    "import google.generativeai as genai\n",
    "import os\n",
    "from dotenv import load_dotenv\n",
    "\n",
    "load_dotenv()\n",
    "genai.configure(api_key=os.getenv(\"GOOGLE_API_KEY\"))\n",
    "model = genai.GenerativeModel(\"gemini-1.5-flash\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "response = model.generate_content(\"Does RCB gona win IPL 2025\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "response:\n",
      "GenerateContentResponse(\n",
      "    done=True,\n",
      "    iterator=None,\n",
      "    result=protos.GenerateContentResponse({\n",
      "      \"candidates\": [\n",
      "        {\n",
      "          \"content\": {\n",
      "            \"parts\": [\n",
      "              {\n",
      "                \"text\": \"Whether the Royal Challengers Bangalore (RCB) will win IPL 2025 is impossible to predict with certainty.  The IPL is a highly competitive tournament where many factors influence the outcome, including player form, injuries, team chemistry, and luck.  While RCB has a strong fanbase and a talented roster, predicting a win two years out is pure speculation.\\n\"\n",
      "              }\n",
      "            ],\n",
      "            \"role\": \"model\"\n",
      "          },\n",
      "          \"finish_reason\": \"STOP\",\n",
      "          \"avg_logprobs\": -0.15194688345256605\n",
      "        }\n",
      "      ],\n",
      "      \"usage_metadata\": {\n",
      "        \"prompt_token_count\": 12,\n",
      "        \"candidates_token_count\": 76,\n",
      "        \"total_token_count\": 88\n",
      "      },\n",
      "      \"model_version\": \"gemini-1.5-flash\"\n",
      "    }),\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "print(response)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Whether the Royal Challengers Bangalore (RCB) will win IPL 2025 is impossible to predict with certainty.  The IPL is a highly competitive tournament where many factors influence the outcome, including player form, injuries, team chemistry, and luck.  While RCB has a strong fanbase and a talented roster, predicting a win two years out is pure speculation.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(response.text)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Resume Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def analyze_resume(resume_text, job_description=None):\n",
    "    if not resume_text:\n",
    "        return {\"error\": \"Resume text is required for analysis.\"}\n",
    "    \n",
    "    model = genai.GenerativeModel(\"gemini-1.5-flash\")\n",
    "    \n",
    "    base_prompt = f\"\"\"\n",
    "    You are an experienced HR with Technical Experience in the field of any one job role from Data Science, Data Analyst, DevOPS, Machine Learning Engineer, Prompt Engineer, AI Engineer, Full Stack Web Development, Big Data Engineering, Marketing Analyst, Human Resource Manager, Software Developer your task is to review the provided resume.\n",
    "    Please share your professional evaluation on whether the candidate's profile aligns with the role.ALso mention Skills he already have and siggest some skills to imorve his resume , alos suggest some course he might take to improve the skills.Highlight the strengths and weaknesses.\n",
    "\n",
    "    Resume:\n",
    "    {resume_text}\n",
    "    \"\"\"\n",
    "\n",
    "    if job_description:\n",
    "        base_prompt += f\"\"\"\n",
    "        Additionally, compare this resume to the following job description:\n",
    "        \n",
    "        Job Description:\n",
    "        {job_description}\n",
    "        \n",
    "        Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.\n",
    "        \"\"\"\n",
    "\n",
    "    response = model.generate_content(base_prompt)\n",
    "\n",
    "    analysis = response.text.strip()\n",
    "    return analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "## Resume Evaluation for Max Johnson\n",
      "\n",
      "**Role Focus:**  To best evaluate Max's resume, I will assume we are considering roles that leverage his experience in **Marketing/GTM Strategy with a focus on AI/ML applications**. This aligns with his experience at Oracle and Fractal, as well as his project portfolio.  My expertise as an experienced HR professional with a technical background in **Data Science** informs this assessment.\n",
      "\n",
      "**Strengths:**\n",
      "\n",
      "* **Relevant Experience:** Max's internships and current role showcase experience in GTM strategy, market research, client engagement, and project management, all highly relevant to marketing roles with a technical component.\n",
      "* **Strong Technical Skills:**  His skills in Python, various cloud platforms (GCP, OCI), and AI/ML tools (LangChain, OpenAI, Hugging Face) are significant assets.  The Oracle certifications are impressive and demonstrate a commitment to learning.\n",
      "* **Impressive Projects:** The \"Document Genie\" and \"FinSight\" projects clearly demonstrate his ability to build functional applications leveraging LLMs and other AI tools. These are excellent showcases of his abilities.\n",
      "* **Excellent Academic Record:** A CGPA of 9.2/10 demonstrates strong academic performance.\n",
      "* **Certifications:**  The array of Oracle certifications and the DeepLearning.ai course showcase commitment to professional development within AI/ML.\n",
      "\n",
      "\n",
      "**Weaknesses:**\n",
      "\n",
      "* **Resume Structure:** The resume could be better structured to highlight achievements rather than just responsibilities.  Using the STAR method (Situation, Task, Action, Result) for each bullet point would significantly improve impact. Quantifiable results (e.g., \"increased leads by X%\") are missing and would greatly strengthen the impact of his experience.\n",
      "* **Lack of Focus:** The resume tries to cover a broad range of skills and experiences. Focusing on a specific area (e.g., AI-powered marketing, GTM strategy using AI tools) would make it more impactful for target roles.\n",
      "* **Limited Data Science Depth:** While he possesses skills in Python and relevant libraries, his resume doesn't highlight in-depth data analysis or modeling experience which is essential for data-driven marketing.\n",
      "* **Missing Portfolio Link:** A link to a portfolio showcasing his projects (e.g., GitHub, personal website) would significantly enhance the resume.\n",
      "\n",
      "**Skills Max Already Has:**\n",
      "\n",
      "* **Programming:** Python, Pandas, Streamlit\n",
      "* **Cloud Computing:** Google Cloud Platform (GCP), Oracle Cloud Infrastructure (OCI)\n",
      "* **AI/ML:** LangChain, OpenAI, Google AI Studio, Hugging Face, Gemini-PRO, Palm LLM\n",
      "* **Data Visualization:** (Implied by Streamlit projects)\n",
      "* **Project Management:** Jira, Asana, Agile methodologies\n",
      "* **Marketing:** GTM Strategy, Market Research, Content Creation, Client Engagement\n",
      "* **Tools:** Confluence, Figma\n",
      "\n",
      "\n",
      "**Skills to Improve:**\n",
      "\n",
      "* **Advanced Data Analysis:**  Deepen his knowledge of data manipulation, statistical analysis, and data visualization techniques beyond basic Python libraries.\n",
      "* **SQL:** Proficiency in SQL is essential for data extraction and manipulation in many marketing analytics contexts.\n",
      "* **Data Storytelling/Visualization:**  The ability to present data insights clearly and compellingly is crucial.\n",
      "* **Marketing Analytics:**  Learn marketing analytics platforms (e.g., Google Analytics, Adobe Analytics) and techniques.\n",
      "* **A/B testing and experimentation:** This is crucial for optimizing marketing campaigns.\n",
      "* **Specific AI/ML model deployment and optimization**:  Show more details about deploying and optimizing his models (e.g., considering model efficiency and resource usage).\n",
      "\n",
      "\n",
      "**Suggested Courses:**\n",
      "\n",
      "* **Data Analysis with Python:**  Courses on Coursera, edX, or DataCamp.\n",
      "* **SQL for Data Analysis:**  Similar platforms to above offer strong SQL courses.\n",
      "* **Google Analytics Individual Qualification:**  Google's official certification.\n",
      "* **Marketing Analytics Specialization:**  Coursera offers several specializations focusing on this area.\n",
      "* **Advanced Machine Learning Specialization:**  Courses on Coursera or edX which focus on deployment, optimization and evaluation metrics of ML models.\n",
      "* **Cloud-Based Data Engineering:** Learn how to build and manage data pipelines on cloud platforms.\n",
      "\n",
      "\n",
      "\n",
      "**Overall Assessment:**\n",
      "\n",
      "Max Johnson demonstrates strong potential for roles involving GTM strategy and the application of AI/ML to marketing.  However, by improving the resume structure, highlighting quantifiable achievements, and focusing on a more specific niche, he can significantly strengthen his candidacy.  Investing in further training in advanced data analysis and marketing analytics will be highly beneficial.  The addition of a portfolio website would showcase his capabilities vividly.\n"
     ]
    }
   ],
   "source": [
    "print(analyze_resume(resume_text))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}