<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gaurav Kumar on Medium]]></title>
        <description><![CDATA[Stories by Gaurav Kumar on Medium]]></description>
        <link>https://medium.com/@gk0415439?source=rss-6a8574c73386------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mVX347IoH0rdx-Xi1YDodw.jpeg</url>
            <title>Stories by Gaurav Kumar on Medium</title>
            <link>https://medium.com/@gk0415439?source=rss-6a8574c73386------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:49:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gk0415439/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run Hunyuan3D 2.1 for free on Kaggle, using both T4 GPUs]]></title>
            <link>https://medium.com/@gk0415439/hunyuan3d-2-1-free-kaggle-image-to-3d-model-cc69c9e447b8?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc69c9e447b8</guid>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[3d-modeling]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Fri, 23 Oct 2026 14:04:00 GMT</pubDate>
            <atom:updated>2026-10-23T14:04:00.250Z</atom:updated>
            <content:encoded><![CDATA[<h3>A free notebook that turns your images into textured 3D models, and how it works under the hood</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2iWI_0nHM9u4psh-92x1TA.png" /></figure><p>So, I wanted to turn an image of a character into a textured 3D model that I could rig and animate in Mixamo. Tencent’s Hunyuan3D 2.1 is one of the best open models for this right now. You give it one image, and it gives you a mesh with PBR textures (albedo, metallic, roughness) that you can drop into Blender, Mixamo or a game engine.</p><p>The catch is the GPU. The official README says it takes 10 GB of VRAM for shape generation, 21 GB for texturing and 29 GB for both together. Free GPUs don’t come close to that, Colab and Kaggle give you a 16 GB T4.</p><p>But Kaggle actually gives you two T4s in one session, for free. So, I built a notebook that runs the shape model on one GPU and the texture model on the other, and I am giving it out for free.</p><p><strong>GitHub:</strong> <a href="https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle">https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle</a></p><p><strong>Open it in Kaggle:</strong> <a href="https://kaggle.com/kernels/welcome?src=https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle/blob/main/hunyuan3d_2_1_kaggle_dual_t4.ipynb">https://kaggle.com/kernels/welcome?src=https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle/blob/main/hunyuan3d_2_1_kaggle_dual_t4.ipynb</a></p><p>In this article, I will first show how to use it, and then go through the code. Most of my time actually went into making it install, load and save properly on Kaggle, so if you only care about results, the first half is enough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SsPHqvTyqqsDJwt5eu7aDg.png" /><figcaption>One image in, one textured .glb out.</figcaption></figure><h3>What you get</h3><ul><li>Upload a folder of images to Kaggle and press Run All.</li><li>For every image, you get textured_mesh.glb (and the untextured white_mesh.glb), all zipped into hy3d_results.zip.</li><li>The last cell shows a 3D preview of the model right inside the notebook.</li><li>Up to 50 images per run. If the session stops, re-running skips the models that are already done.</li></ul><p>A PNG with a transparent background works best. Other images get their background removed automatically.</p><h3>How to use it</h3><h3>Step 1: Save the weights as a Kaggle dataset (once, no GPU needed)</h3><p>The models are 17.8 GB in total. The notebook can download them every session, but that adds 5 to 10 minutes every time. So, there is a second small notebook that downloads them once into a private dataset of yours.</p><ol><li>Import hunyuan3d_2_1_weights_builder.ipynb into Kaggle (File, then Import Notebook, then paste the GitHub link).</li><li>Settings: Accelerator <strong>None</strong>, Internet <strong>On</strong>. It needs no GPU, so it does not use any of your weekly GPU hours.</li><li>Save Version, then <strong>Save &amp; Run All (Commit)</strong>. It takes about 10 to 20 minutes.</li><li>Open the finished version, go to the <strong>Output</strong> tab and choose <strong>New Dataset</strong>. Name it something like hunyuan3d-2-1-weights and keep it private.</li></ol><h3>Step 2: Run the main notebook</h3><ol><li>Open hunyuan3d_2_1_kaggle_dual_t4.ipynb in Kaggle.</li><li>Settings: Accelerator <strong>GPU T4 x2</strong>, Internet <strong>On</strong> (Kaggle needs a phone-verified account for this).</li><li>Add Input, then Upload, and add a folder with your images.</li><li>Add Input, then Your Datasets, and add the weights dataset from Step 1. The notebook finds it automatically.</li><li>Run All.</li></ol><p>Setup takes about 10 minutes, mostly installing packages and compiling the CUDA rasterizer. After that, a status line prints every 30 seconds with the usage and memory of each GPU, so you can see both of them working.</p><p>For a long batch, use Save Version, then Save &amp; Run All (Commit), so it keeps running after you close the tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HwOFQqS749tnNkMo2GOBw.png" /><figcaption>Shape on cuda:0, texture on cuda:1.</figcaption></figure><h3>How it works</h3><h3>Two stages, two GPUs, one folder queue</h3><p>Hunyuan3D 2.1 has two separate models:</p><ul><li><strong>Shape</strong> (cuda:0): removes the background and turns the image into an untextured mesh.</li><li><strong>Paint</strong> (cuda:1): takes that mesh and the image, generates multiple views with a diffusion model, upscales them and bakes them into PBR textures.</li></ul><p>Each stage runs as its own Python process, and each process only sees one GPU because of CUDA_VISIBLE_DEVICES. Neither model has to share 16 GB with the other. With a batch of images, they also work at the same time: while GPU 1 is texturing model N, GPU 0 is already shaping model N+1.</p><p>The launcher is just subprocess.Popen with a different environment for each worker:</p><pre>def launch(script, gpu):<br>    log = open(f&quot;{WORK}/{script}.log&quot;, &quot;w&quot;)<br>    env = dict(os.environ, CUDA_VISIBLE_DEVICES=str(gpu), PYTHONUNBUFFERED=&quot;1&quot;,<br>               HY3DGEN_MODELS=WEIGHTS,             # where hy3dshape looks for tencent/Hunyuan3D-2.1<br>               U2NET_HOME=f&quot;{WEIGHTS}/u2net&quot;)      # where rembg looks for u2net.onnx<br>    if OFFLINE:<br>        env[&quot;HF_HUB_OFFLINE&quot;] = &quot;1&quot;  # everything is local: fail loudly rather than download<br>    return subprocess.Popen([sys.executable, f&quot;{WORK}/{script}.py&quot;, f&quot;{WORK}/config.json&quot;],<br>                            stdout=log, stderr=subprocess.STDOUT, env=env)</pre><p>The two workers talk through a folder. When the shape worker finishes a mesh, it writes a small JSON job file. It writes to a temp file first and then renames it, because a rename is atomic, so the paint worker never reads half a file:</p><pre>def enqueue(job):<br>    tmp = os.path.join(cfg[&quot;queue&quot;], f&quot;.{job[&#39;name&#39;]}.tmp&quot;)<br>    with open(tmp, &quot;w&quot;) as f:<br>        json.dump(job, f)<br>    os.replace(tmp, os.path.join(cfg[&quot;queue&quot;], f&quot;{job[&#39;name&#39;]}.json&quot;))  # atomic: paint never sees half a file</pre><p>The paint worker picks the oldest job, and stops when the queue is empty and the shape worker has written _SHAPE_DONE:</p><pre>while True:<br>    job_file = next_job()<br>    if job_file is None:<br>        # Shape writes _SHAPE_DONE after its last enqueue, so re-check the queue once it appears.<br>        if os.path.exists(os.path.join(cfg[&quot;queue&quot;], &quot;_SHAPE_DONE&quot;)) and next_job() is None:<br>            break<br>        time.sleep(2)<br>        continue<br>    ...</pre><p>One more detail here. Kaggle gives you about 30 GB of RAM, and loading both models at the same time can run out of it. So, the paint worker only starts after the shape worker writes _SHAPE_READY (its model is on the GPU). With only one GPU, the notebook runs the two stages one after the other on that GPU.</p><p>While a model is loading, the GPU sits at 0% and it looks stuck. So, the status line also shows how many GB each worker has read so far, from /proc/&lt;pid&gt;/io:</p><pre>def read_gb(proc):<br>    &quot;&quot;&quot;Bytes a worker has read so far - shows model loading progress while the GPUs sit at 0%.&quot;&quot;&quot;<br>    try:<br>        return int(open(f&quot;/proc/{proc.pid}/io&quot;).read().split(&quot;rchar:&quot;)[1].split()[0]) / 2**30<br>    except (OSError, IndexError, ValueError):<br>        return 0.0</pre><h3>Installing on top of Kaggle’s PyTorch</h3><p>The official install reinstalls PyTorch. On Kaggle, that is a few GB of download and a good chance of breaking the CUDA setup, so the install script keeps Kaggle’s torch and only adds the rest. A few things needed fixing on the way:</p><p><strong>numpy.</strong> The repo wants numpy 1.26, which has no wheels for Python 3.13. A constraints file picks the right version for the Python it finds:</p><pre>&quot;$PY&quot; -c &quot;import sys; print(&#39;numpy==1.26.4&#39; if sys.version_info &lt; (3, 13) else &#39;numpy&lt;2.3&#39;)&quot; &gt; /tmp/hy3d/constraints.txt</pre><p><strong>Blender (bpy).</strong> One file imports bpy, which has no wheel for this Python, and is only used by a helper the notebook does not need. One sed line makes the import optional.</p><p><strong>The texture upscaler.</strong> basicsr and realesrgan don&#39;t install on Python 3.13. I replaced the upscaler class with one that uses spandrel, which loads the same RealESRGAN_x4plus.pth weights:</p><pre>class imageSuperNet:<br>    def __init__(self, config) -&gt; None:<br>        model = ModelLoader().load_from_file(config.realesrgan_ckpt_path)<br>        assert isinstance(model, ImageModelDescriptor)<br>        device = torch.device(config.device)<br>        dtype = torch.float16 if device.type == &quot;cuda&quot; else torch.float32<br>        self.model = model.to(device).to(dtype).eval()<br>        self.device, self.dtype = device, dtype</pre><pre>    @torch.no_grad()<br>    def __call__(self, image):<br>        x = torch.from_numpy(np.array(image.convert(&quot;RGB&quot;))).permute(2, 0, 1)[None]<br>        y = self.model(x.to(self.device, self.dtype) / 255.0).clamp(0, 1)<br>        return Image.fromarray((y[0].permute(1, 2, 0).float().cpu().numpy() * 255).round().astype(np.uint8))</pre><p><strong>The CUDA rasterizer.</strong> It has to be compiled, and by default it compiles for every GPU architecture. The script asks torch which GPUs are in the session (T4 is 7.5) and compiles only for those, which is much faster:</p><pre>export TORCH_CUDA_ARCH_LIST=$(&quot;$PY&quot; -c &quot;import torch; print(&#39;;&#39;.join(sorted({&#39;%d.%d&#39; % torch.cuda.get_device_capability(i) for i in range(torch.cuda.device_count())})))&quot;)</pre><p>The notebook runs the script with subprocess.run(..., check=True) instead of !bash, so if the install fails, Run All stops right there instead of scrolling past the error.</p><h3>Loading 17.8 GB of weights fast</h3><p>Attaching the weights as a dataset solved the downloads, but loading was still slow. Kaggle streams dataset files over the network the first time you read them, and one sequential reader gets around 17 MB/s. Each model took more than 7 minutes just to load.</p><p>So, the first cell starts a background copy of the dataset to local disk, while the install is running. It splits every file into 64 MB chunks and reads them with 16 threads:</p><pre>def copy(job):<br>    global copied<br>    p, out, off, n = job<br>    with open(p, &quot;rb&quot;) as fi, open(out, &quot;r+b&quot;) as fo:<br>        fi.seek(off)<br>        fo.seek(off)<br>        while n:<br>            buf = fi.read(min(n, 8 &lt;&lt; 20))<br>            if not buf:<br>                raise IOError(f&quot;short read: {p}&quot;)<br>            fo.write(buf)<br>            n -= len(buf)<br>            with lock:<br>                copied += len(buf)</pre><pre>with ThreadPoolExecutor(16) as pool:<br>    list(pool.map(copy, jobs))</pre><p>By the time the install is done, the copy is usually done too, and the models load from local disk.</p><h3>Three patches inside the paint worker</h3><p><strong>1. Never download what is already there.</strong> The texture pipeline always calls snapshot_download() for its models. The worker swaps that function for one that returns the local folder when it exists:</p><pre>_download = huggingface_hub.snapshot_download<br>def _local_first(repo_id, *args, **kwargs):<br>    local = os.path.join(cfg[&quot;weights&quot;], repo_id)<br>    return local if os.path.isdir(local) else _download(repo_id, *args, **kwargs)<br>huggingface_hub.snapshot_download = _local_first  # multiview_utils looks it up at call time</pre><p><strong>2. Keep the detail you asked for.</strong> This one took me a while to find. My first models had soft faces and mitten-like fingers, even with a higher face count. It turned out the paint step remeshes every model to 40,000 faces before texturing, no matter what you set. And it uses open3d, which is not installed in the notebook, so at one point it simply crashed. The worker replaces that function with a pymeshlab decimation that only reduces the mesh when it is above your max_faces:</p><pre>def remesh_to_max_faces(mesh_path, remesh_path):<br>    ms = pymeshlab.MeshSet()<br>    ms.load_new_mesh(mesh_path)<br>    if ms.current_mesh().face_number() &gt; cfg[&quot;max_faces&quot;]:<br>        ms.meshing_decimation_quadric_edge_collapse(targetfacenum=cfg[&quot;max_faces&quot;])<br>    ms.save_current_mesh(remesh_path, save_textures=False)</pre><pre>textureGenPipeline.remesh_mesh = remesh_to_max_faces  # the pipeline looks it up as a module global at call time</pre><p>With max_faces=200000, fingers come out as separate fingers.</p><p><strong>3. GLB files that open everywhere.</strong> The repo’s GLB export stores the textures as data URIs inside the JSON, all labelled image/png, even though the base colour is a JPEG. Web viewers don&#39;t mind, but it is not valid GLB, and Windows 3D Viewer showed my models without any texture. The worker moves every image into the binary chunk with the correct MIME type:</p><pre>for image in gltf.images:<br>    if not (image.uri or &quot;&quot;).startswith(&quot;data:&quot;):<br>        continue<br>    data = base64.b64decode(image.uri.split(&quot;,&quot;, 1)[1])<br>    blob += b&quot;\x00&quot; * (-len(blob) % 4)  # bufferViews must be 4-byte aligned<br>    gltf.bufferViews.append(pygltflib.BufferView(buffer=0, byteOffset=len(blob), byteLength=len(data)))<br>    blob += data<br>    mime = &quot;image/jpeg&quot; if data[:3] == b&quot;\xff\xd8\xff&quot; else &quot;image/png&quot;<br>    image.uri, image.bufferView, image.mimeType = None, len(gltf.bufferViews) - 1, mime</pre><h3>Settings worth knowing</h3><p>All of these are in the settings cell:</p><ul><li>octree_resolution=256: 384 or 512 gives finer geometry, with more VRAM and time.</li><li>steps=30: the official demo default. 50 is slightly sharper and slower.</li><li>max_faces=40000: set 200000 for characters, it keeps faces and fingers much sharper. Texturing takes longer.</li><li>texture_views=6 and texture_resolution=512: the official demo uses 8 views at 768 on a 24 GB card. 6 at 512 is safe on a 16 GB T4.</li><li>seed=1234: change it to get a different shape from the same image.</li><li>skip_existing=True: re-running only does the images that are not finished.</li></ul><h3>What it is not good at (yet)</h3><p>I want to be honest here. Small details in a full-body image, like the face and the fingers, only get a few pixels, so they come out soft. A higher max_faces helps the geometry a lot, but the face texture still won&#39;t match a photo. For my own avatar, I generated the head from a separate close-up image and I am fixing the face in Blender before joining it to the body. For animating in Mixamo, a full-body image in a T-pose works best.</p><h3>Troubleshooting</h3><ul><li><strong>OUT OF GPU MEMORY in the paint log:</strong> keep texture_resolution=512 and lower texture_views to 6. If the shape stage runs out, lower octree_resolution or num_chunks.</li><li><strong>nvcc not found:</strong> the session has no GPU attached. Set the accelerator to GPU T4 x2 and restart.</li><li><strong>Install fails on a package:</strong> Kaggle updates its image regularly. The error usually names the package. Loosen that pin in install.sh and rerun the cell.</li><li><strong>Session restarted:</strong> /tmp is wiped, so run everything again. skip_existing=True picks up where it stopped.</li><li>The full logs are in /tmp/hy3d/shape_worker.log and /tmp/hy3d/paint_worker.log.</li></ul><h3>License</h3><p>The notebook code is MIT, so do whatever you want with it. Hunyuan3D 2.1 itself, its weights and its outputs are under the Tencent Hunyuan 3D 2.1 Community License. Read it before any commercial use. It does not apply in the EU, the UK or South Korea.</p><h3>Try it</h3><p>Everything is here: <a href="https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle">https://github.com/Gaurav-Kumar98/hunyuan3d-2.1-kaggle</a></p><p>I built it with Claude Code, and it is free. If something breaks on your Kaggle session, open an issue on GitHub with the error from the log and I will take a look. A good GPU should not be the reason you can’t try image-to-3D.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc69c9e447b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built a ghost that keeps my AI prompts, and made it open-source]]></title>
            <link>https://medium.com/@gk0415439/free-open-source-ai-prompt-manager-peekaprompt-2eb7418771c8?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/2eb7418771c8</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[side-project]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 19:49:06 GMT</pubDate>
            <atom:updated>2026-10-15T19:49:06.909Z</atom:updated>
            <content:encoded><![CDATA[<h3>I built a free, open-source AI prompt manager that hides on the edge of my screen</h3><h3>A tiny desktop app with a ghost called Peeky. It saves your ChatGPT and Claude prompts and copies any of them in one click.</h3><figure><img alt="PeekaPrompt, a free open-source AI prompt manager, with its ghost mascot peeking from the edge of the screen" src="https://cdn-images-1.medium.com/max/1024/1*GVVTNT5bv7d8wTHgPf8rRw.png" /><figcaption>Peeky lives on the edge of your screen and keeps your prompts one click away.</figcaption></figure><p><a href="https://drive.google.com/file/d/1cQ6BUHytcj7wOSUy8cysmT3ot-eNR5nD/view?usp=sharing">PeekaPrompt.mp4</a></p><p>I work as a data engineer, and on the side I build android/web apps that solve pain points of people. AI is part of my day now, at work and in my side projects, and that means I write a lot of prompts. Some of them are one-time, but some of them I use again and again, like a code review prompt or a “rewrite this to be shorter” prompt.</p><p>So, I wanted a simple AI prompt manager. One place where I can save my prompts, categorize them and reuse them later in ChatGPT, Claude or any other AI tool. A notes app could do it, but I know myself, I would not open a notes app every time. It had to be always there, never in the way, and a little fun, so that I actually use it often.</p><p>So, I built PeekaPrompt.</p><h3>What PeekaPrompt does</h3><p>PeekaPrompt is a small desktop app with a ghost called Peeky. Peeky sits on the right edge of your screen, mostly hidden. When you hover over it, it pops out and says hi. When you click it, a drawer slides out with all your saved prompts.</p><p>From there:</p><ul><li><strong>One-click copy.</strong> Click any prompt card and it is copied to your clipboard. The drawer tucks itself away so you can paste it straight into ChatGPT, Claude, Gemini or wherever you are working.</li><li><strong>Categories.</strong> Save prompts with a title and a category. Every category gets its own emoji and colour.</li><li><strong>Search.</strong> Type to filter your prompt library, and press Enter to copy the top match without touching the mouse.</li><li><strong>Favourites.</strong> Star a prompt and it stays on top.</li><li><strong>Global shortcut.</strong> Press Ctrl+Alt+P from anywhere to bring the drawer out.</li><li><strong>Move it.</strong> Drag the ghost up or down if it is sitting on top of something you need.</li></ul><p>There is also a dice button. It picks a random prompt from whatever you are looking at, scrolls to it and highlights it. It sounds silly, but it is a nice way to rediscover prompts you saved and forgot about.</p><figure><img alt="PeekaPrompt drawer showing saved prompt cards with categories and a “Copied!” message after one click" src="https://cdn-images-1.medium.com/max/852/1*tsnKJlFxfZFLTyDeanvtbA.png" /><figcaption>Click a card and the prompt is on your clipboard.</figcaption></figure><h3>The fun part: XP, streaks and badges</h3><p>This was actually the most important part for me. If a tool is boring, I stop opening it after a week. So, I added a few game elements:</p><ul><li><strong>XP and levels.</strong> You get XP for saving, copying and rolling the dice. You start as a “Prompt Pebble” and level up to “Prompt Deity”.</li><li><strong>Daily streaks.</strong> The first use of the day gives you bonus XP, and the flame counter goes up if you come back the next day.</li><li><strong>Badges.</strong> There are 12 of them, like “Copy Cat” for 25 copies and “Night Owl” if you use it after midnight.</li><li><strong>Peeky has moods.</strong> It blinks, its eyes follow your cursor around the screen, it bounces when you copy something and looks sad when you delete a prompt.</li><li><strong>Confetti</strong> on every copy, because why not.</li></ul><figure><img alt="PeekaPrompt trophy screen with level, XP, daily streak and a grid of badges to unlock" src="https://cdn-images-1.medium.com/max/852/1*URZiARhqRGqqYmbLzsP3EA.png" /><figcaption>Levels, streaks and 12 badges to keep you coming back.</figcaption></figure><h3>How I built it with Claude Code</h3><p>I built the whole app with Claude Code. My first prompt was close to how I would explain it to a friend: a simple desktop app that stays half hidden at the side of the screen and comes back when clicked, saves my prompts so I can reuse them, lets me categorize them, and has some fun elements that make me use it often. I also asked it to give the app a fun name, and that is where PeekaPrompt came from.</p><p>The first version worked well, but it had a dark purple theme that I did not like. So, I asked Claude to show me 4 different variations on a design canvas, with only one rule, keep the ghost as it is. I got Bubblegum Pop, Neon Arcade, Lemon Soda and Haunted Pumpkin. I liked Lemon Soda the most, with its cream background, thick black outlines and lemon/mint/tangerine colours. I tried the Haunted Pumpkin font on it, did not like it, and went back to the original. Then I noticed the settings icon looked like a filter icon, so it became a gear that spins when you hover over it.</p><p>After using it for a bit, I wanted Peeky to peek out a little more so I could actually see it, and a better hover animation. Now it leans out with big excited eyes and a tiny “Boo!” or “Hi!” bubble.</p><figure><img alt="Adding a new prompt in PeekaPrompt with a title, prompt text and a category selector" src="https://cdn-images-1.medium.com/max/852/1*iTIdN7cjnp1_CoWTfpnRmg.png" /><figcaption>Adding a new prompt takes a few seconds.</figcaption></figure><h3>How the half-hidden window works (for developers)</h3><p>A few details that I found interesting while building it:</p><ul><li><strong>It is plain Electron with vanilla JavaScript.</strong> No framework and no build step, so the whole app is a handful of files that are easy to read.</li><li><strong>The half-hidden trick.</strong> The window is frameless, transparent and always on top, and most of it sits outside the screen. When the drawer is closed, only the tab with Peeky is visible.</li><li><strong>It does not block your clicks.</strong> The transparent parts of the window let mouse clicks pass through to the app behind it. They only become clickable when your cursor is over the tab or the drawer.</li><li><strong>The slide is just the window moving.</strong> Opening and closing animates the window’s position with an ease-out curve.</li><li><strong>Your data stays local.</strong> Everything is saved in one JSON file on your machine. There is no account, no server and no tracking.</li></ul><h3>Try it: free and open-source on GitHub</h3><p>PeekaPrompt is free and open-source under the MIT license. You can find the code, screenshots and install steps here: <a href="https://github.com/Gaurav-Kumar98/peekaprompt">PeekaPrompt on GitHub</a>.</p><p>You need Node.js, and then it is four commands:</p><pre>git clone https://github.com/Gaurav-Kumar98/peekaprompt.git<br>cd peekaprompt<br>npm install<br>npm start</pre><p>Some things I would love to add next, and contributions are welcome:</p><ul><li>Variables like {{topic}} that ask you for a value when you copy the prompt</li><li>Import and export of your prompt library</li><li>More themes, maybe the other three variations</li><li>Docking to the left side of the screen</li><li>Proper installers, so you don’t need Node.js</li></ul><h3>FAQ</h3><p><strong>Is PeekaPrompt free?</strong><br>Yes. It is free and open-source under the MIT license.</p><p><strong>Does it work with ChatGPT, Claude and Gemini?</strong><br>Yes. PeekaPrompt copies the prompt to your clipboard, so it works with any AI tool or website where you can paste text.</p><p><strong>Where are my prompts stored?</strong><br>In a single JSON file on your own computer (on Windows: %APPDATA%\peekaprompt\prompts.json). Nothing is sent to any server.</p><p><strong>Does it work on macOS and Linux?</strong><br>I have built and tested it on Windows 11. It is an Electron app, so it should run on macOS and Linux with npm start, but I have not tested those yet. If you try it, please let me know how it goes.</p><p><strong>Can I contribute?</strong><br>Yes. Issues and pull requests are welcome on GitHub.</p><h3>One small takeaway</h3><p>This was a small project, but it reminded me of something. The tools I actually use every day are not the most powerful ones, they are the ones that are right there when I need them and don’t feel like a chore. If something small annoys you every day, build the small tool for it. The good chances are that someone else needs it too.</p><p>If PeekaPrompt is useful for you, a star on <a href="https://github.com/Gaurav-Kumar98/peekaprompt">GitHub</a> would mean a lot.</p><p><em>I am Gaurav, a data engineer who builds android/web apps on the side to solve everyday problems. I am building in public, so follow me here on Medium for what I build next.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2eb7418771c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Capture First, Organize Later: A Local-First Way to Manage Side Projects]]></title>
            <link>https://medium.com/@gk0415439/capture-first-organize-later-a-local-first-way-to-manage-side-projects-f7eb2db056ac?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7eb2db056ac</guid>
            <category><![CDATA[indiehackers]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[kanban]]></category>
            <category><![CDATA[localfirst]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Wed, 03 Jun 2026 03:01:01 GMT</pubDate>
            <atom:updated>2026-06-03T03:01:01.825Z</atom:updated>
            <content:encoded><![CDATA[<h4>The real cost of your project tracker isn’t the subscription. It’s the friction tax on every idea you have.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NAZSv8HSUROrgEcq" /><figcaption>Photo by <a href="https://unsplash.com/@dillonjshook?utm_source=medium&amp;utm_medium=referral">Dillon Shook</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You’re ninety minutes deep into a build. The code is flowing. Then you spot a bug — a dropdown that sticks after selection. You <em>know</em> that if you stop to open Notion, create a card, pick a project, fill four fields, and upload a screenshot, the thread you’re holding in your head will snap.</p><p>So you make a quiet deal with yourself: <em>I’ll remember it.</em></p><p>You won’t. That bug is already gone, and so are the twelve other ideas you had this week. The problem isn’t your memory or your discipline. It’s that your tools charge too much for the one thing you do most: capturing a thought.</p><h3>The Capture Tax: the cost no one prices in</h3><p>Here’s the counter-intuitive truth most productivity advice misses. The real cost of a project management tool isn’t the monthly subscription. It’s the Capture Tax — the friction you pay <em>every single time</em> you try to get something out of your head and into the system.</p><p>That tax is invisible because you never see the invoice. You just see the symptoms:</p><ul><li>Bugs you rediscover three weeks later, in production</li><li>A backlog that’s suspiciously tidy because you quietly stopped using it</li><li>Great ideas that died because logging them cost more than thinking them</li></ul><blockquote><em>A tracker you don’t capture into isn’t a tracker. It’s a graveyard with good fonts.</em></blockquote><p>If capturing a task costs more than the task is worth, you won’t capture it. Full stop.</p><h3>What “local-first” actually means</h3><p>This is where local-first project management changes the math — and the term is worth pinning down, because it gets thrown around loosely.</p><p>Local-first means your data lives on <em>your</em> machine first, not in a vendor’s cloud. The app reads and writes to a local database, so there’s no network round-trip between your keystroke and the result. That buys you three things cloud SaaS structurally can’t:</p><ul><li>Speed that feels instant — no spinners, no “syncing…”</li><li>Real ownership — your backlog is a file you control, not a row in someone else’s table</li><li>Privacy by default — screenshots of your unreleased product never leave your laptop</li></ul><p>It’s why self-hosted kanban boards and offline-first tools are having a moment. When you’re juggling five side projects, you don’t need a collaboration platform built for a 200-person team. You need a fast, private place to think.</p><h3>The Capture-First Framework</h3><p>Speed alone isn’t a strategy. After years of building solo, I’ve boiled my workflow down to one principle and three rules.</p><blockquote><em>Capture first. Organize later.</em></blockquote><p>Most people do the opposite — they obsess over the perfect structure <em>before</em> the work exists. That’s backwards. Here’s the fix.</p><h3>Rule 1: If capture takes more than 3 seconds, you’ve lost</h3><p>Set a hard budget: three seconds for text, five for a screenshot. Type, hit Enter, done. No modal, no required fields, no mouse.</p><p>The moment capture demands a decision — <em>which project? what priority?</em> — you’ve reintroduced the Capture Tax. Decisions are organization. Organization is not capture. Keep them apart.</p><h3>Rule 2: Let most of your backlog die — on purpose</h3><p>This is the rule that makes people uncomfortable. A healthy backlog is mostly dead weight, and that’s a feature.</p><p>Every captured item has a half-life. Most ideas that feel urgent at 11 p.m. are irrelevant by Friday. Capture is cheap; curation is expensive. So capture everything, and let the trivial 80% quietly rot. The 20% that keeps resurfacing is your real roadmap — and it revealed itself for free.</p><h3>Rule 3: Organize only what a task earns</h3><p>When a task survives — when you keep seeing it and thinking <em>yeah, that still matters</em> — it earns a priority, a tag, a phase. Organization becomes a reward you grant proven tasks, not a toll you pay on every passing thought.</p><p>That single inversion is the difference between a system that serves you and one you serve.</p><h3>The advanced move: let your AI file its own tickets</h3><p>Here’s the part that’s genuinely ahead of the curve.</p><p>If you build with AI assistants — Claude, Cursor, an agent in your terminal — you already let AI write to your <em>codebase</em>. The next step almost no one is doing: let it write to your backlog, too.</p><p>With a local board exposed over something like the Model Context Protocol (MCP), your assistant can create, move, and update tasks directly:</p><ul><li>It finds a bug while refactoring → it files the card itself, before you even context-switch.</li><li>You finish a feature → “move everything tagged auth to Review&quot; happens in one sentence.</li><li>Your backlog stops being something <em>you</em> maintain and becomes something your tools maintain <em>with</em> you.</li></ul><p>That’s the payoff cloud tools can’t match: when the data sits on your machine, your agents reach it with no OAuth dance and no rate limits. Your tracker becomes part of your dev environment, not a tab you forget to open.</p><h3>How to build a capture-first setup</h3><p>You don’t need a new subscription — you need a tool that respects the Capture Tax. Look for:</p><ul><li>Instant text + screenshot capture (paste from clipboard straight into a task)</li><li>A local database you own — SQLite is perfect</li><li>Optional AI autofill to turn a raw screenshot into a titled, tagged card</li><li>Phases, so MVP work stays separate from polish</li><li>No accounts, no cloud, no friction</li></ul><p>This is the itch I built ProjectFlow to scratch — an open-source, local-first kanban for AI-assisted builders. Paste a screenshot, hit Enter, and it’s a card with the image attached. It runs entirely on your machine in a single SQLite file, has Gemini-powered autofill, and ships an MCP server so your AI can manage the board for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4dXH30Q_sUjVj0hr2VXig.png" /><figcaption>A screenshot of the app</figcaption></figure><p>It isn’t trying to be Jira. It’s trying to disappear.</p><h3>Stop paying the Capture Tax</h3><p>Your ideas aren’t the problem. Your discipline isn’t the problem. The friction between your brain and your backlog is — and going local-first is the most direct way to remove it.</p><p>Capture first. Let the noise die. Organize only what survives. Do that, and your backlog stops being a chore and becomes the most honest map of what you’re actually building.</p><p><em>If this resonated, a few claps 👏 help it reach other builders fighting the same friction — and you can highlight the line that hit hardest.</em></p><p><em>I write about building software solo and the tools I make along the way. Follow to catch the next one.</em></p><p><em>ProjectFlow is free and open-source (MIT) — </em><a href="https://github.com/Gaurav-Kumar98/ProjectFlow"><em>try it on GitHub</em></a><em>.</em></p><p><em>Your turn, in the responses:</em> <em>what’s one tool you abandoned because it was too slow for the way you actually work?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7eb2db056ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From My Phone to the Cloud: Building a Real-Time Activity Tracker with Kafka, Spark, and Snowflake]]></title>
            <link>https://medium.com/@gk0415439/from-my-phone-to-the-cloud-building-a-real-time-activity-tracker-with-kafka-spark-and-snowflake-4e528d0e83a7?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e528d0e83a7</guid>
            <category><![CDATA[real-time-analytics]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[snowflake]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Thu, 22 May 2025 20:05:05 GMT</pubDate>
            <atom:updated>2025-05-27T08:21:06.360Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A learning adventure into the world of streaming data pipelines, from sensor data ingestion to cloud data warehousing, with practical tips for taking it further.</strong></p><p>Hey everyone!</p><p>Ever had that itch to learn a new set of technologies and decided the best way was to just… build something? That was me! I wanted to get hands-on experience with real-time (or near real-time) streaming data pipelines and the cloud data platform Snowflake, neither of which I’d used extensively in my career. I knew about the “Sensor Logger” app, which conveniently streams phone sensor data, and an idea began to form: why not build an end-to-end activity tracker?</p><p>This post is a chronicle of that journey — the architecture I landed on, the tech I wrangled, the inevitable hurdles, and the “aha!” moments. While this started as a learning project (so it’s not battle-hardened for massive scale <em>just yet</em>), I’ve also sprinkled in tips on how one might nudge each component closer to a production-ready state.</p><h3>The “Why”: Stepping into the Stream</h3><p>My primary goal was practical experience. I wanted to move beyond theory and truly understand:</p><ul><li>Real-time data flow: How does data <em>actually</em> get ingested, processed, and delivered in a continuous stream?</li><li>Apache Spark Streaming: What’s it like to work with this powerful stream processing engine?</li><li>Apache Kafka: How does this distributed streaming platform act as the central nervous system for data?</li><li>Snowflake: I was keen to explore this popular cloud-native data warehouse and see how it fits into a streaming architecture.</li></ul><p>Interestingly, my first thought for storage was PostgreSQL with the TimescaleDB extension. But, to really stretch my learning, I pivoted to Snowflake. This decision added an extra layer of “how-to” that proved incredibly valuable.</p><h3>The Blueprint: Charting the Data’s Course</h3><p>Here’s a bird’s-eye view of how data travels in the system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*49o5WdULRTrWCtN_ZP7nQg.png" /><figcaption>[Phone Sensor (Sensor Logger App)] → [Python Flask API] → [Apache Kafka Topics] → [Apache Spark Streaming] → [Snowflake Tables] → [Grafana Dashboards]</figcaption></figure><p>Let’s walk through each stage:</p><h4><strong>1. Getting the Data: Sensor Logger to Flask API</strong></h4><ul><li><strong>Sensor Logger App:</strong> This nifty Android app streams sensor readings (accelerometer, gyroscope, etc.) via HTTP POST requests. I configured it to send accelerometer data (specifically, linear acceleration, which excludes gravity – a key detail for my activity classification).</li><li><strong>Flask API (</strong><strong>flaskserver/app.py):</strong> A lightweight Python Flask server acts as the entry point. It receives JSON payloads from Sensor Logger, extracts the necessary fields, and publishes the data to a Kafka topic.</li></ul><p>Here’s a snippet of the Flask API:</p><pre>from flask import Flask, request, jsonify<br>from utils.kafka_producer import KafkaProducer # Assumes a utility class for Kafka interaction<br>import logging<br><br># Initialize Flask app and Kafka producer<br>app = Flask(__name__)<br>producer = KafkaProducer() # Utility to send messages to Kafka<br><br>@app.route(&#39;/sensor-data&#39;, methods=[&#39;POST&#39;])<br>def receive_data():<br>    try:<br>        incoming_data = request.json<br>        # print(f&quot;Received message ID: {incoming_data}&quot;) # For debugging<br>        <br>        # Extract common metadata from the incoming request<br>        metadata = {<br>            &quot;messageId&quot;: incoming_data[&quot;messageId&quot;],<br>            &quot;sessionId&quot;: incoming_data[&quot;sessionId&quot;],<br>            &quot;deviceId&quot;: incoming_data[&quot;deviceId&quot;]<br>        }<br>        <br>        # Iterate through each sensor reading in the payload<br>        for sensor_reading in incoming_data[&quot;payload&quot;]:<br>            # Construct the message to be sent to Kafka, enriching it with metadata<br>            kafka_message = {<br>                **metadata, # Spread the common metadata<br>                &quot;sensorType&quot;: sensor_reading[&quot;name&quot;],<br>                &quot;x&quot;: sensor_reading[&quot;values&quot;][&quot;x&quot;],<br>                &quot;y&quot;: sensor_reading[&quot;values&quot;][&quot;y&quot;],<br>                &quot;z&quot;: sensor_reading[&quot;values&quot;][&quot;z&quot;],<br>                &quot;accuracy&quot;: sensor_reading[&quot;accuracy&quot;],<br>                &quot;timestamp&quot;: sensor_reading[&quot;time&quot;] # Original timestamp from sensor<br>            }<br>            <br>            # Send the prepared message to the Kafka topic<br>            producer.send_to_kafka(kafka_message) # Method within KafkaProducer utility<br>            # print(f&quot;Sent {sensor_reading[&#39;name&#39;]} data to Kafka&quot;) # For debugging<br>        <br>        return jsonify({&quot;status&quot;: &quot;success&quot;, &quot;processed_readings&quot;: len(incoming_data[&quot;payload&quot;])}), 200<br>    except Exception as e:<br>        logging.error(f&quot;Error processing request: {str(e)}&quot;, exc_info=True)<br>        return jsonify({&quot;status&quot;: &quot;error&quot;, &quot;message&quot;: str(e)}), 500<br><br>if __name__ == &#39;__main__&#39;:<br>    # Run the Flask app locally, accessible on all network interfaces<br>    app.run(host=&#39;0.0.0.0&#39;, port=5000)</pre><blockquote><strong>Production-Ready Tip for Flask API:</strong> For a real-world scenario, this API would need more muscle: a production-grade WSGI server (like Gunicorn) behind a reverse proxy (Nginx), robust error handling, input validation, security (API keys/OAuth), and possibly asynchronous processing for better throughput.</blockquote><h4><strong>2. The Data Highway: Apache Kafka</strong></h4><ul><li><strong>Kafka Topics Utilized:</strong> The system uses two primary Kafka topics: raw_sensor_data for incoming raw sensor readings from the Flask API, and processed_activity where Spark Streaming publishes the classified user activity (e.g., stationary, walking).</li></ul><p>(These topics are auto-created by Kafka in this project setup, as seen in docker-compose.yml below with KAFKA_AUTO_CREATE_TOPICS_ENABLE: &quot;true&quot;).</p><ul><li><strong>Why Kafka?</strong> It’s the industry standard for a reason! It decouples data producers from consumers, offers message durability, and scales beautifully.</li></ul><blockquote><strong>Production-Ready Tip for Kafka:</strong> In production, you’d absolutely want a Schema Registry (like Confluent Schema Registry) to manage data schemas, preventing headaches down the line. Careful planning of topic partitions and replication factors is also crucial for scalability and fault tolerance, alongside robust monitoring and security (SASL/SSL).</blockquote><h4><strong>3. The Brains of the Operation: Spark Streaming (</strong><strong>spark-streaming/activity_detection.py)</strong></h4><p>This is where the raw data gets its meaning. A PySpark Streaming application listens to raw_sensor_data, processes it, and classifies user activity.</p><pre>from pyspark.sql import SparkSession<br>from pyspark.sql.functions import from_json, col, sqrt, window, avg, lit, struct, to_json, when<br>from pyspark.sql.types import StructType, StructField, LongType, StringType, DoubleType, IntegerType, TimestampType<br><br># Constants for activity classification<br>STATIONARY_THRESHOLD = 2.0 <br>WALKING_THRESHOLD = 8.0     <br>RUNNING_THRESHOLD = 20.0   <br># SPRINTING is any magnitude &gt;= RUNNING_THRESHOLD<br><br># Window settings for aggregations<br>WINDOW_DURATION = &quot;10 seconds&quot; # Duration of the window<br>SLIDE_DURATION = &quot;2 seconds&quot;   # How often the window slides<br>WATERMARK_DELAY = &quot;10 seconds&quot; # How long to wait for late data<br><br># 1. Initialize Spark Session<br>spark = SparkSession.builder \<br>    .appName(&quot;ActivityDetection&quot;) \<br>    .config(&quot;spark.jars.packages&quot;, &quot;org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.0&quot;) \<br>    .getOrCreate()<br><br># Define the schema for the incoming JSON data from Kafka<br>schema = StructType([<br>    StructField(&quot;messageId&quot;, LongType()),<br>    StructField(&quot;sessionId&quot;, StringType()),<br>    StructField(&quot;deviceId&quot;, StringType()),<br>    StructField(&quot;sensorType&quot;, StringType()),<br>    StructField(&quot;x&quot;, DoubleType()),<br>    StructField(&quot;y&quot;, DoubleType()),<br>    StructField(&quot;z&quot;, DoubleType()),<br>    StructField(&quot;accuracy&quot;, IntegerType()),<br>    StructField(&quot;timestamp&quot;, LongType())  # Original timestamp in nanoseconds<br>])<br><br># 2. Consume from Kafka (raw_sensor_data topic)<br>kafka_df = spark.readStream \<br>    .format(&quot;kafka&quot;) \<br>    .option(&quot;kafka.bootstrap.servers&quot;, &quot;kafka:29092&quot;) \<br>    .option(&quot;subscribe&quot;, &quot;raw_sensor_data&quot;) \<br>    .option(&quot;failOnDataLoss&quot;, &quot;false&quot;) \<br>    .option(&quot;startingOffsets&quot;, &quot;earliest&quot;) \<br>    .load()<br><br># 3. Parse JSON and Filter<br># Cast the Kafka value to string and parse JSON using the defined schema<br>parsed_df = kafka_df.select(<br>    from_json(col(&quot;value&quot;).cast(&quot;string&quot;), schema).alias(&quot;data&quot;)<br>).select(<br>    col(&quot;data.messageId&quot;),<br>    col(&quot;data.sessionId&quot;),<br>    col(&quot;data.deviceId&quot;),<br>    col(&quot;data.sensorType&quot;),<br>    col(&quot;data.x&quot;),<br>    col(&quot;data.y&quot;),<br>    col(&quot;data.z&quot;),<br>    # Convert nanosecond timestamp to Spark TimestampType<br>    (col(&quot;data.timestamp&quot;) / 1e9).cast(TimestampType()).alias(&quot;timestamp&quot;) <br>)<br><br># Filter for &#39;accelerometer&#39; data only, as other sensors might be present<br>filtered_df = parsed_df.filter(col(&quot;sensorType&quot;) == &quot;accelerometer&quot;)<br><br># 4. Feature Engineering: Calculate acceleration magnitude<br># Magnitude = sqrt(x^2 + y^2 + z^2)<br>magnitude_df = filtered_df.withColumn(<br>    &quot;magnitude&quot;,<br>    sqrt(col(&quot;x&quot;)**2 + col(&quot;y&quot;)**2 + col(&quot;z&quot;)**2)<br>)<br><br># 5. Windowed Aggregation &amp; Watermarking<br># Group data by window, session, and device, then calculate average magnitude<br>windowed_avg_magnitude_df = magnitude_df \<br>    .withWatermark(&quot;timestamp&quot;, WATERMARK_DELAY) \<br>    .groupBy(<br>        window(col(&quot;timestamp&quot;), WINDOW_DURATION, SLIDE_DURATION),<br>        col(&quot;sessionId&quot;), <br>        col(&quot;deviceId&quot;)   <br>    ).agg(<br>        avg(&quot;magnitude&quot;).alias(&quot;avg_magnitude&quot;)<br>    )<br><br># 6. Activity Classification (based on avg_magnitude) &amp; Confidence<br>activity_df = windowed_avg_magnitude_df.withColumn(<br>    &quot;activity&quot;,<br>    when(col(&quot;avg_magnitude&quot;) &lt; STATIONARY_THRESHOLD, &quot;stationary&quot;)<br>    .when(col(&quot;avg_magnitude&quot;) &lt; WALKING_THRESHOLD, &quot;walking&quot;)<br>    .when(col(&quot;avg_magnitude&quot;) &lt; RUNNING_THRESHOLD, &quot;running&quot;)<br>    .otherwise(&quot;sprinting&quot;)<br>).withColumn(<br>    &quot;confidence&quot;, # Assign a placeholder confidence score<br>    when(col(&quot;avg_magnitude&quot;) &lt; STATIONARY_THRESHOLD, 0.95)<br>    .when(col(&quot;avg_magnitude&quot;) &lt; WALKING_THRESHOLD, 0.85)<br>    .when(col(&quot;avg_magnitude&quot;) &lt; RUNNING_THRESHOLD, 0.75)<br>    .otherwise(0.70)<br>).select(<br>    col(&quot;window.end&quot;).alias(&quot;event_timestamp&quot;), # Use window end time as event time<br>    col(&quot;sessionId&quot;), <br>    col(&quot;deviceId&quot;),  <br>    col(&quot;activity&quot;),<br>    col(&quot;confidence&quot;),<br>    col(&quot;avg_magnitude&quot;)<br>)<br><br># 7. Publish to Kafka (processed_activity topic)<br># Prepare the DataFrame for Kafka by converting it to JSON strings<br>kafka_output_df = activity_df.select(<br>    to_json(struct(<br>        col(&quot;event_timestamp&quot;).cast(&quot;string&quot;).alias(&quot;timestamp&quot;), # Kafka expects string timestamp<br>        col(&quot;sessionId&quot;),<br>        col(&quot;deviceId&quot;),<br>        col(&quot;activity&quot;),<br>        col(&quot;confidence&quot;),<br>        col(&quot;avg_magnitude&quot;)<br>    )).alias(&quot;value&quot;) # Kafka message value<br>)<br><br># Write the stream to the &#39;processed_activity&#39; Kafka topic<br>kafka_sink_query = kafka_output_df.writeStream \<br>    .format(&quot;kafka&quot;) \<br>    .option(&quot;kafka.bootstrap.servers&quot;, &quot;kafka:29092&quot;) \<br>    .option(&quot;topic&quot;, &quot;processed_activity&quot;) \<br>    .option(&quot;checkpointLocation&quot;, &quot;/tmp/checkpoint/activity_detection_kafka&quot;) \<br>    .outputMode(&quot;append&quot;) \<br>    .start()<br><br># Keep the application running<br>kafka_sink_query.awaitTermination()</pre><p><strong>Challenges faced in Spark Streaming:</strong></p><ul><li><strong>Managing Checkpointing with Schema Evolution:</strong> A significant challenge encountered was dealing with Spark Streaming’s checkpointing mechanism when the schema of the stateful operations changed. For instance, modifying groupBy fields led to state-compatibility errors. The workaround for this project involved clearing the checkpoint directory. However, in a production setting, more robust strategies such as state versioning, employing flexible serialization formats like Avro, or implementing carefully planned state migrations would be essential.</li><li><strong>Leveraging Console Output for Debugging:</strong> A key learning was the effectiveness of using writeStream.format(&quot;console&quot;) for debugging the streaming application. This technique proved invaluable for inspecting the data in-flight at various stages of the pipeline, greatly aiding in troubleshooting and understanding data transformations.</li><li><strong>Iterative Process for Threshold Tuning:</strong> The development of the activity classification logic highlighted the importance of an iterative approach to tuning thresholds. The initial parameters for distinguishing between stationary, walking, running, and sprinting were refined over time. This involved experimenting with different features, such as magnitude with gravity included and standard deviation, before settling on the average magnitude of gravity-excluded accelerometer data. This tuning process required patience, observation, and repeated testing.</li></ul><blockquote><strong>Production-Ready Tips for Spark Streaming:</strong> Modular code with comprehensive tests is essential. Externalize configurations rather than hardcoding them. Monitor the Spark UI closely for performance bottlenecks and ensure robust error handling and alerting mechanisms are in place.</blockquote><h4><strong>4. Storing the Insights: Snowflake</strong></h4><ul><li><strong>Snowflake Database:</strong> ACTIVITY_DB</li><li><strong>Snowflake Schemas:</strong> RAW_DATA (for raw sensor readings) and PROCESSED_DATA (for classified activities).</li><li><strong>Snowflake Tables:</strong> RAW_DATA.ACTIVITY_RECORDS and PROCESSED_DATA.USER_ACTIVITY_PROCESSED.</li></ul><p>A conceptual DDL for the processed data table might look like this:</p><pre>CREATE TABLE IF NOT EXISTS ACTIVITY_DB.PROCESSED_DATA.USER_ACTIVITY_PROCESSED (<br>    EVENT_TIMESTAMP TIMESTAMP_NTZ, -- Timestamp of when the activity was classified<br>    SESSIONID VARCHAR(255),      -- Identifier for the user session<br>    DEVICEID VARCHAR(255),       -- Identifier for the device<br>    ACTIVITY VARCHAR(50),        -- Classified activity (e.g., stationary, walking)<br>    CONFIDENCE FLOAT,            -- Confidence score of the classification<br>    AVG_MAGNITUDE FLOAT          -- Average acceleration magnitude for the window<br>);</pre><ul><li><strong>Kafka Connect for Snowflake:</strong> I used the official Snowflake Kafka Connector. This was a smooth experience, configured via JSON files (snowflake-sink-raw-config.json, snowflake-sink-processed-config.json - not shown here) to sink data from the Kafka topics directly into the respective Snowflake tables. The connector is managed within the kafka-connect Docker service. Key configurations (like Snowflake URL, user, private key) are passed as environment variables in docker-compose.yml.</li></ul><blockquote><strong>Production-Ready Tips for Snowflake:</strong> Security is paramount. For key management, my project mounted Snowflake keys from a file. In production, use robust methods like Snowflake’s key pair authentication, environment variables via Docker/Kubernetes secrets, or a secrets manager (e.g., HashiCorp Vault). Never commit credentials! Also, leverage Snowflake’s network policies and RBAC. For cost and performance, choose appropriate virtual warehouse sizes with auto-suspend/resume and define clustering keys. Monitor query history and costs. For data governance, implement data quality checks and utilize Snowflake’s Time Travel feature.</blockquote><h4><strong>5. Seeing the Results: Grafana Cloud</strong></h4><p>Instead of self-hosting, I leveraged <strong>Grafana Cloud</strong>, connecting it directly to Snowflake as a data source. This allowed me to build dashboards to visualize raw sensor trends and, more importantly, the classified user activities over time without managing Grafana infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-heFrxwWtz75SpA70laRpw.jpeg" /><figcaption>Real-time Activity Monitoring Dashboard</figcaption></figure><p>The dashboard provides real-time visibility into:</p><ul><li>Current activity state (Stationary, Walking, Running, Sprinting)</li><li>Activity confidence levels</li><li>Movement magnitude over time</li><li>Historical activity timeline</li><li>Activity distribution analytics</li></ul><h3>Bringing It All Together: Docker Compose</h3><p>Most of the stack (Kafka, Zookeeper, Spark, Kafka Connect) is orchestrated via Docker Compose (docker-compose.yml). This made development and testing incredibly convenient. The Flask API runs locally, and as mentioned earlier, Grafana is cloud-hosted rather than self-hosted in the Docker environment.</p><p>Here’s a more comprehensive look at relevant parts of the docker-compose.yml:</p><pre>version: &#39;3&#39;<br><br>services:<br>  # Kafka Ecosystem<br>  zookeeper:<br>    image: confluentinc/cp-zookeeper:7.4.0<br>    ports:<br>      - &quot;2181:2181&quot;<br>    environment:<br>      ZOOKEEPER_CLIENT_PORT: 2181<br><br>  kafka:<br>    image: confluentinc/cp-kafka:7.4.0<br>    depends_on:<br>      - zookeeper<br>    ports:<br>      - &quot;9092:9092&quot; # For host access<br>    environment:<br>      KAFKA_BROKER_ID: 1<br>      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 # Connect to Zookeeper within Docker network<br>      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT<br>      # Advertised listeners: PLAINTEXT for inter-container communication, PLAINTEXT_HOST for host access<br>      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092 <br>      KAFKA_AUTO_CREATE_TOPICS_ENABLE: &quot;true&quot; # Allows topics to be created automatically<br>      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 # For single-broker setup<br><br>  kafka-connect:<br>    image: confluentinc/cp-kafka-connect:7.4.0<br>    depends_on:<br>      - kafka<br>    ports:<br>      - &quot;8083:8083&quot; # Kafka Connect REST API<br>    environment:<br>      CONNECT_BOOTSTRAP_SERVERS: kafka:29092 # Kafka brokers for Connect<br>      CONNECT_REST_ADVERTISED_HOST_NAME: kafka-connect<br>      CONNECT_GROUP_ID: compose-connect-group<br>      # Configuration for internal Kafka Connect topics<br>      CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs<br>      CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1<br>      CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets<br>      CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1<br>      CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status<br>      CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1<br>      # Default converters<br>      CONNECT_KEY_CONVERTER: org.apache.kafka.connect.storage.StringConverter<br>      CONNECT_VALUE_CONVERTER: org.apache.kafka.connect.json.JsonConverter<br>      # Path for connectors plugins<br>      CONNECT_PLUGIN_PATH: &quot;/usr/share/java,/usr/share/confluent-hub-components&quot;<br>      <br>      # Snowflake Connector Configuration - IMPORTANT: SECURE YOUR CREDENTIALS<br>      CONNECT_SNOWFLAKE_URL: &quot;youraccount.snowflakecomputing.com&quot; # Replace with your Snowflake account URL<br>      CONNECT_SNOWFLAKE_USER: &quot;KAFKA_SINK_USER&quot; # Replace with your Snowflake user<br>      # The private key should be securely managed, not hardcoded or committed. <br>      # This is a placeholder showing an environment variable.<br>      CONNECT_SNOWFLAKE_PRIVATE_KEY: &quot;YOUR_SNOWFLAKE_PRIVATE_KEY_CONTENT_OR_PATH&quot; <br>      CONNECT_SNOWFLAKE_PRIVATE_KEY_PASSPHRASE: &quot;YOUR_PASSPHRASE_IF_KEY_IS_ENCRYPTED&quot; # Optional<br>      CONNECT_SNOWFLAKE_DATABASE: &quot;ACTIVITY_DB&quot;<br>      CONNECT_SNOWFLAKE_SCHEMA: &quot;RAW_DATA&quot; # Default schema for connectors, can be overridden per connector<br>      CONNECT_SNOWFLAKE_WAREHOUSE: &quot;KAFKA_CONNECT_WH&quot; # Optional: Specific warehouse for Kafka Connect<br>    command: <br>      - bash <br>      - -c <br>      - |<br>        # Install connectors (JDBC is often a dependency or useful)<br>        confluent-hub install --no-prompt confluentinc/kafka-connect-jdbc:10.7.0 &amp;&amp; \<br>        confluent-hub install --no-prompt snowflakeinc/snowflake-kafka-connector:latest &amp;&amp; \<br>        # Run Kafka Connect<br>        /etc/confluent/docker/run<br><br>  kafka-init: # Service to initialize Kafka topics and connectors<br>    image: confluentinc/cp-kafka:7.4.0 <br>    depends_on:<br>      - kafka<br>      - kafka-connect # Wait for Kafka Connect to be available<br>    volumes:<br>      # Mounts script to create topics and deploy connector configurations<br>      - ./scripts/init-kafka.sh:/tmp/init-kafka.sh <br>      # Mount connector configuration files<br>      - ./docker/connector-configs/snowflake-sink-raw-config.json:/config/snowflake-sink-raw-config.json<br>      - ./docker/connector-configs/snowflake-sink-processed-config.json:/config/snowflake-sink-processed-config.json<br>    command: [&quot;sh&quot;, &quot;/tmp/init-kafka.sh&quot;] # Executes the initialization script<br><br>  spark:<br>    image: bitnami/spark:3.3.0<br>    depends_on:<br>      - kafka # Spark job consumes from Kafka<br>    networks:<br>      - default  # Ensure Spark is on the same Docker network as Kafka<br>    environment:<br>      # Pass Kafka bootstrap servers to Spark (using Docker service name)<br>      - KAFKA_BOOTSTRAP_SERVERS=kafka:29092  <br>    volumes:<br>      # Mount Spark application code<br>      - ./spark-streaming:/app <br>      # Mount custom Log4j properties if needed<br>      - ./log4j2.properties:/opt/bitnami/spark/conf/log4j2.properties <br>      # Mount checkpoint directory for Spark Streaming state<br>      - ./checkpoint:/tmp/checkpoint <br>    command: &gt; # Command to submit the Spark application<br>      /opt/bitnami/spark/bin/spark-submit<br>      --master local[*]<br>      --packages org.apache.spark:spark-sql-kafka-0-10_2.12:3.3.0<br>      /app/activity_detection.py</pre><blockquote><strong>Production-Ready Tip for Orchestration: </strong>For production, you’d look at optimized Docker images (multi-stage builds), CI/CD pipelines (Jenkins, GitLab CI, GitHub Actions), Infrastructure as Code (Terraform), and centralized logging/monitoring (ELK, Prometheus).</blockquote><h3>Key Learnings &amp; “Aha!” Moments</h3><ul><li>The Power of the Stream: Seeing data flow and transform in near real-time is genuinely exciting.</li><li>Snowflake’s Connector Ecosystem: The Kafka connector made integration much simpler than I initially anticipated.</li><li>Iterate, Iterate, Iterate: The activity detection logic wasn’t perfect on day one. Starting simple, testing, and refining was key.</li><li>Debugging is an Art: From Spark’s console output to Kafka consumer tools and simply querying Snowflake table counts — every bit helped.</li></ul><p>This project was an incredibly rewarding way to learn. It’s not a turnkey production system, but it’s a solid blueprint that demonstrates how these powerful technologies can collaborate.</p><h3>What Could Be Next?</h3><p>The fun doesn’t have to stop! Future ideas include:</p><ul><li>More sophisticated Machine Learning models for activity detection.</li><li>Real-time alerting for specific activity patterns.</li><li>Personalized user dashboards and historical trend analysis.</li><li>Deploying the whole setup to a cloud provider using Kubernetes.</li></ul><h3>Final Thoughts</h3><p>If you’re looking to dive into real-time data pipelines, Spark Streaming, or Snowflake, I can’t recommend a hands-on project enough. Pick a data source that interests you (like the Sensor Logger app!), define a clear goal, and start building. The journey from raw data to actionable insights is a fantastic learning curve.</p><p>I’d love to hear your thoughts or if you’ve embarked on similar learning projects! Feel free to share your experiences in the comments.</p><p>The complete codebase for this project is available on <a href="https://github.com/Gaurav-Kumar98/activity-tracker.git">GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e528d0e83a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CVInsight: Now Available as a Python Package!]]></title>
            <link>https://medium.com/@gk0415439/cvinsight-now-available-as-a-python-package-370ab3a13d52?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/370ab3a13d52</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[recruitment]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Tue, 20 May 2025 14:40:20 GMT</pubDate>
            <atom:updated>2025-05-20T14:40:20.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGIa7m892AjiGsk6L5_nqw.png" /><figcaption>Generated by ChatGPT</figcaption></figure><p>After exploring the journey of building our Resume Analysis System with LLMs in previous blog posts, I’m excited to announce that CVInsight is now available as a Python package on PyPI! This means you can easily integrate powerful resume analysis capabilities into your own applications with just a few lines of code.</p><h3>From Project to Package</h3><p>In our <a href="https://medium.com/@gk0415439/building-a-resume-parser-with-llms-a-step-by-step-guide-part-i-03682a68bc8b">first blog post</a>, we explored the core architecture of our resume analysis system. In the <a href="https://medium.com/@gk0415439/building-a-resume-parser-with-llms-part-2-plugin-architecture-advanced-features-f6cb9328db3d">second post</a>, we enhanced the system with a plugin architecture and advanced features.</p><p>Now, we’ve taken the next logical step: packaging CVInsight for easy distribution and use by the community. This transformation involved:</p><ol><li>Refactoring the codebase for a clean, consistent API</li><li>Creating a proper package structure with setuptools</li><li>Developing comprehensive documentation</li><li>Building a simple yet powerful command-line interface</li><li>Implementing a clean client interface for programmatic use</li></ol><h3>Features of the CVInsight Package</h3><p>The packaged version of CVInsight comes with several improvements:</p><h4>1. Simple Client Interface</h4><p>The new CVInsightClient class provides a clean, intuitive interface to all CVInsight functionality:</p><pre>from cvinsight import CVInsightClient<br><br># Initialize with your API key<br>client = CVInsightClient(api_key=&quot;your_google_api_key&quot;)<br><br># Analyze a resume<br>results = client.extract_all(&quot;path/to/resume.pdf&quot;)</pre><h4>2. Functional API</h4><p>For those who prefer a functional approach, CVInsight also exposes functions for direct use:</p><pre>from cvinsight import extract_profile, extract_skills<br><br># Get just the profile information<br>profile = extract_profile(&quot;path/to/resume.pdf&quot;)<br><br># Get just the skills<br>skills = extract_skills(&quot;path/to/resume.pdf&quot;)</pre><h4>3. Command-Line Interface</h4><p>CVInsight now includes a CLI for easy use from the terminal:</p><pre># Install the package<br>pip install cvinsight<br><br># Process a resume and output results as JSON<br>cvinsight --resume path/to/resume.pdf --json<br><br># List available plugins<br>cvinsight --list-plugins<br><br># Use specific plugins only<br>cvinsight --resume path/to/resume.pdf --plugins profile_extractor,skills_extractor</pre><h4>4. Token Usage Tracking</h4><p>The package maintains our advanced token usage tracking, now with improved logging:</p><pre># Token usage is automatically logged to the &#39;logs&#39; directory<br>client.extract_all(&quot;path/to/resume.pdf&quot;, log_token_usage=True)</pre><h4>5. Expanded Plugin System</h4><p>The plugin system is now more robust, with easier ways to discover and use plugins:</p><pre># List all available plugins<br>plugins = client.list_all_plugins()<br><br># List plugins by category<br>analyzer_plugins = client.list_plugins_by_category(&quot;ANALYZER&quot;)<br><br># Analyze a resume with specific plugins<br>results = client.analyze_resume(&quot;path/to/resume.pdf&quot;, <br>                             plugins=[&quot;profile_extractor&quot;, &quot;skills_extractor&quot;])</pre><h3>Installation</h3><p>Getting started with CVInsight is as simple as:</p><pre>pip install cvinsight</pre><p>The package requires Python 3.9 or later and automatically installs all necessary dependencies.</p><h3>Setting Up Your Google API Key</h3><p>To use CVInsight, you’ll need a Google API key for the Gemini models:</p><ol><li>Visit <a href="https://makersuite.google.com/">Google AI Studio</a></li><li>Sign in with your Google account</li><li>Navigate to the “Get API key” option</li><li>Create a new API key</li><li>Set it in your code or environment:</li></ol><pre># Option 1: Pass directly to the client<br>client = CVInsightClient(api_key=&quot;your_google_api_key&quot;)<br><br># Option 2: Set as environment variable<br>import os<br>os.environ[&quot;GOOGLE_API_KEY&quot;] = &quot;your_google_api_key&quot;<br><br># Option 3: Use a .env file (recommended for development)<br># First, create a .env file in your project root:<br># GOOGLE_API_KEY=your_google_api_key<br><br># Then, load it in your Python code:<br>from dotenv import load_dotenv<br>load_dotenv()  # Load environment variables from .env file<br>client = CVInsightClient()  # Will automatically use the API key from .env</pre><h3>A Complete Example</h3><p>Let’s walk through a complete example of using CVInsight to analyze a resume:</p><pre>import json<br>from cvinsight import CVInsightClient<br><br># Initialize the client<br>client = CVInsightClient()<br><br># Analyze a resume<br>resume_data = client.extract_all(&quot;example_resume.pdf&quot;)<br><br># Print the results<br>print(f&quot;Name: {resume_data.get(&#39;name&#39;, &#39;Not found&#39;)}&quot;)<br>print(f&quot;Email: {resume_data.get(&#39;email&#39;, &#39;Not found&#39;)}&quot;)<br><br># Print skills<br>print(&quot;\nSkills:&quot;)<br>for skill in resume_data.get(&#39;skills&#39;, []):<br>    print(f&quot;- {skill}&quot;)<br><br># Print education history<br>print(&quot;\nEducation:&quot;)<br>for edu in resume_data.get(&#39;educations&#39;, []):<br>    print(f&quot;- {edu.get(&#39;degree&#39;)} at {edu.get(&#39;institution&#39;)}&quot;)<br>    print(f&quot;  {edu.get(&#39;start_date&#39;, &#39;N/A&#39;)} to {edu.get(&#39;end_date&#39;, &#39;N/A&#39;)}&quot;)<br>    <br># Print work experience<br>print(&quot;\nWork Experience:&quot;)<br>for exp in resume_data.get(&#39;work_experiences&#39;, []):<br>    print(f&quot;- {exp.get(&#39;role&#39;)} at {exp.get(&#39;company&#39;)}&quot;)<br>    print(f&quot;  {exp.get(&#39;start_date&#39;, &#39;N/A&#39;)} to {exp.get(&#39;end_date&#39;, &#39;N/A&#39;)}&quot;)<br>    <br># Print years of experience<br>print(f&quot;\nYears of Experience: {resume_data.get(&#39;YoE&#39;, &#39;Not found&#39;)}&quot;)<br># Save the results to a JSON file<br>with open(&quot;resume_analysis.json&quot;, &quot;w&quot;) as f:<br>    json.dump(resume_data, f, indent=2)</pre><p>This will produce output like:</p><pre>Name: John Doe<br>Email: john.doe@example.com<br><br>Skills:<br>- Python<br>- Machine Learning<br>- Data Analysis<br>- SQL<br>- JavaScript<br><br>Education:<br>- Bachelor of Science in Computer Science at University of Example<br>  2015-09 to 2019-05<br><br>Work Experience:<br>- Software Engineer at Tech Company Inc.<br>  2019-06 to 2023-03<br><br>Years of Experience: 4 years</pre><h3>Extending CVInsight with Custom Plugins</h3><p>One of the most powerful features of CVInsight is its plugin system. You can easily extend the functionality by creating custom plugins:</p><pre>from typing import Dict, Any, Type<br>from pydantic import BaseModel<br>from cvinsight.base_plugins import ExtractorPlugin, PluginMetadata, PluginCategory<br><br>class CandidateMatchPlugin(ExtractorPlugin):<br>    &quot;&quot;&quot;Plugin to match candidates to job descriptions.&quot;&quot;&quot;<br>    <br>    def __init__(self, job_description: str):<br>        self.job_description = job_description<br>        super().__init__()<br>    <br>    @property<br>    def metadata(self) -&gt; PluginMetadata:<br>        return PluginMetadata(<br>            name=&quot;candidate_matcher&quot;,<br>            version=&quot;1.0.0&quot;,<br>            description=&quot;Matches candidates to job descriptions&quot;,<br>            category=PluginCategory.ANALYZER,<br>            author=&quot;Your Name&quot;<br>        )<br>    <br>    def get_model(self) -&gt; Type[BaseModel]:<br>        # Define your Pydantic model for the output<br>        from pydantic import BaseModel, Field<br>        <br>        class MatchResult(BaseModel):<br>            match_score: int = Field(..., description=&quot;Match score from 0-100&quot;)<br>            key_matches: list[str] = Field(default_factory=list, description=&quot;Key matching skills/qualifications&quot;)<br>            missing_requirements: list[str] = Field(default_factory=list, description=&quot;Missing requirements&quot;)<br>            <br>        return MatchResult<br>    <br>    def get_prompt_template(self) -&gt; str:<br>        return &quot;&quot;&quot;<br>        Evaluate how well the candidate&#39;s resume matches the following job description.<br>        Provide a match score from 0-100, list key matching skills/qualifications, and identify missing requirements.<br>        <br>        JOB DESCRIPTION:<br>        {job_description}<br>        <br>        RESUME:<br>        {text}<br>        <br>        {format_instructions}<br>        &quot;&quot;&quot;<br>    <br>    def get_input_variables(self) -&gt; list[str]:<br>        return [&quot;text&quot;, &quot;job_description&quot;]<br>    <br>    def prepare_input_data(self, extracted_text: str) -&gt; Dict[str, Any]:<br>        return {<br>            &quot;text&quot;: extracted_text,<br>            &quot;job_description&quot;: self.job_description<br>        }</pre><p>To use your custom plugin:</p><pre>from cvinsight import CVInsightClient<br>from my_plugins import CandidateMatchPlugin<br><br># Initialize the client<br>client = CVInsightClient()<br><br># Create the custom plugin<br>job_description = &quot;Looking for a Python developer with 3+ years of experience in ML...&quot;<br>matcher_plugin = CandidateMatchPlugin(job_description)<br><br># Register your plugin<br>client._plugin_manager.register_plugin(matcher_plugin)<br><br># Process a resume using all plugins (including your custom one)<br>result = client.extract_all(&quot;path/to/resume.pdf&quot;)<br><br># Access the results from your custom plugin<br>match_result = result.get(&quot;candidate_matcher&quot;, {})<br>print(f&quot;Match score: {match_result.get(&#39;match_score&#39;)}/100&quot;)</pre><h3>Future Roadmap</h3><p>As we continue to develop CVInsight, here are some features we’re planning for future releases:</p><ol><li>Web Interface: A simple web UI for uploading and analyzing resumes</li><li>Resume Comparison: Tools for comparing multiple candidates</li><li>Advanced Analytics: More sophisticated analysis plugins</li><li>Integration with ATS Systems: Connectors for popular applicant tracking systems</li><li>Multi-language Support: Expanded support for resumes in different languages</li></ol><h3>Conclusion</h3><p>The release of CVInsight as a Python package marks an important milestone in our journey of building a powerful resume analysis system. By packaging our solution, we’re making advanced resume analysis with LLMs accessible to everyone, from HR professionals to developers building recruitment tools.</p><p>We’re excited to see how the community will use and extend CVInsight. If you build something interesting with it, please let us know!</p><p>Ready to get started? Install CVInsight today:</p><pre>pip install cvinsight</pre><p>The complete source code is available on <a href="https://github.com/Gaurav-Kumar98/CVInsight">GitHub</a>, and we welcome contributions, bug reports, and feature requests.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=370ab3a13d52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Resume Parser with LLMs Part 2: Plugin Architecture & Advanced Features]]></title>
            <link>https://medium.com/@gk0415439/building-a-resume-parser-with-llms-part-2-plugin-architecture-advanced-features-f6cb9328db3d?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6cb9328db3d</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[resume]]></category>
            <category><![CDATA[parser]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[google-gemini]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Thu, 27 Mar 2025 18:14:04 GMT</pubDate>
            <atom:updated>2025-03-27T18:14:04.776Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QYieMQhldyqUwy1KJuvXfA.jpeg" /></figure><p>In my <a href="https://medium.com/@gk0415439/building-a-resume-parser-with-llms-a-step-by-step-guide-part-i-03682a68bc8b">previous article</a>, I walked through the development of a basic Resume Parser using LLMs. Since then, I’ve made significant improvements to make the system more flexible, powerful, and user-friendly. In this post, I’ll share these new features and how they transform the system into a production-ready tool.</p><h3>Evolution from Extractors to Plugins</h3><p>The biggest architectural change is the shift from hard-coded extractors to a flexible plugin-based system. This new architecture enables:</p><ol><li>Easy extensibility without modifying core code</li><li>Better separation of concerns</li><li>Simpler addition of new functionality</li><li>On-demand loading of specific components</li></ol><h3>New Architecture Overview</h3><p>The new system is built around these key components:</p><ul><li>Plugin Manager: Discovers, loads, and manages plugins</li><li>Base Plugin: Abstract base class for all plugins</li><li>Extractor Plugins: Convert the previous extractors into standalone plugins</li><li>Plugin Resume Processor: Processes resumes using loaded plugins</li><li>Enhanced LLM Service: Improved centralized service for LLM interactions</li></ul><h3>Key New Features</h3><h3>1. Plugin-Based Architecture</h3><p>The plugin system is the foundation of the new architecture. Each plugin is a self-contained module that:</p><ul><li>Has its own metadata (name, version, author, description)</li><li>Belongs to a specific category (EXTRACTOR, PROCESSOR, ANALYZER, etc.)</li><li>Implements a standard interface for integration</li><li>Can be enabled or disabled independently</li></ul><pre>@property<br>def metadata(self) -&gt; PluginMetadata:<br>    return PluginMetadata(<br>        name=&quot;skills_extractor&quot;,<br>        version=&quot;1.0.0&quot;,<br>        description=&quot;Extracts skills from resumes&quot;,<br>        category=PluginCategory.EXTRACTOR,<br>        author=&quot;Your Name&quot;<br>    )</pre><h3>2. Support for Multiple File Formats</h3><p>The system now supports both PDF and DOCX resume formats:</p><pre>ALLOWED_FILE_EXTENSIONS = [&#39;.pdf&#39;, &#39;.docx&#39;]</pre><p>This is implemented through a flexible file reader system that automatically detects the file type and uses the appropriate parser.</p><h3>3. Advanced Token Usage Tracking</h3><p>One critical aspect of using LLMs in production is managing token usage. The new system includes:</p><ul><li>Per-plugin token usage tracking</li><li>Detailed token usage reports</li><li>Separate log files for token usage data</li><li>Automatic log rotation to keep log files manageable</li></ul><p>The token usage tracking provides valuable insights:</p><pre>{<br>  &quot;resume_file&quot;: &quot;John_Doe.pdf&quot;,<br>  &quot;processed_at&quot;: &quot;20250323_031534&quot;,<br>  &quot;token_usage&quot;: {<br>    &quot;total_tokens&quot;: 7695,<br>    &quot;prompt_tokens&quot;: 7410,<br>    &quot;completion_tokens&quot;: 285,<br>    &quot;by_extractor&quot;: {<br>      &quot;ProfileExtractorPlugin&quot;: {<br>        &quot;total_tokens&quot;: 1445,<br>        &quot;prompt_tokens&quot;: 1423,<br>        &quot;completion_tokens&quot;: 22<br>      },<br>      // Other extractors...<br>    }<br>  }<br>}</pre><h3>4. Enhanced Command-Line Interface</h3><p>The system now includes a rich command-line interface with various options:</p><pre># Process a single resume file<br>python main.py --resume example.pdf</pre><pre># Only display token usage report for a previously processed resume<br>python main.py --resume example.pdf --report-only</pre><pre># Specify a custom directory for token usage logs<br>python main.py --log-dir ./custom_logs</pre><pre># Enable verbose logging<br>python main.py --verbose</pre><pre># Clean up __pycache__ directories and compiled Python files<br>python main.py --cleanup</pre><h3>5. Custom Plugin Development</h3><p>Perhaps the most powerful feature is the ability to create custom plugins. This allows users to extend the system without modifying the core code:</p><pre>from typing import Dict, Any, Type<br>from pydantic import BaseModel<br>from plugins.base import ExtractorPlugin, PluginMetadata, PluginCategory</pre><pre>class CustomSkillsCategorizer(ExtractorPlugin):<br>    &quot;&quot;&quot;Plugin to categorize skills into technical vs soft skills.&quot;&quot;&quot;<br>    <br>    @property<br>    def metadata(self) -&gt; PluginMetadata:<br>        return PluginMetadata(<br>            name=&quot;skills_categorizer&quot;,<br>            version=&quot;1.0.0&quot;,<br>            description=&quot;Categorizes skills as technical or soft skills&quot;,<br>            category=PluginCategory.PROCESSOR,<br>            author=&quot;Your Name&quot;<br>        )<br>    <br>    def get_model(self) -&gt; Type[BaseModel]:<br>        return SkillCategories<br>    <br>    def get_prompt_template(self) -&gt; str:<br>        return &quot;&quot;&quot;<br>        Categorize the following skills as either TECHNICAL or SOFT skills:<br>        {skills}<br>        <br>        {format_instructions}<br>        &quot;&quot;&quot;<br>    <br>    def process_resume(self, resume: Resume) -&gt; Dict[str, Any]:<br>        # Custom processing logic<br>        categorized_skills = {<br>            &quot;technical_skills&quot;: [],<br>            &quot;soft_skills&quot;: []<br>        }<br>        <br>        # Your categorization logic here<br>        <br>        return categorized_skills</pre><h3>Implementation Highlights</h3><h3>Plugin Manager</h3><p>The Plugin Manager is responsible for discovering, loading, and managing plugins:</p><pre># Initialize plugin manager<br>plugin_manager = PluginManager(llm_service)</pre><pre># Load plugins<br>plugins = plugin_manager.load_all_plugins()</pre><pre># Get specific plugin<br>profile_plugin = plugin_manager.get_plugin(&quot;profile_extractor&quot;)</pre><pre># Get plugins by category<br>extractor_plugins = plugin_manager.get_plugins_by_category(PluginCategory.EXTRACTOR)</pre><h3>Plugin Resume Processor</h3><p>The Plugin Resume Processor replaces the original ResumeProcessor with a more flexible implementation:</p><pre>processor = PluginResumeProcessor(<br>    resume_dir=config.RESUME_DIR,<br>    output_dir=config.OUTPUT_DIR,<br>    log_dir=args.log_dir,<br>    plugin_manager=plugin_manager<br>)</pre><pre># Process a single resume<br>resume = processor.process_resume(&quot;path/to/resume.pdf&quot;)</pre><pre># Process all resumes in the directory<br>processed_count, error_count = processor.process_all_resumes()</pre><h3>Example: Creating a Custom Plugin</h3><p>Let’s walk through creating a custom plugin to assess a candidate’s suitability for a specific role:</p><ul><li>Define our Pydantic model:</li></ul><pre>class RoleFitAssessment(BaseModel):<br>    role_name: str<br>    overall_fit_score: int  # 1-10<br>    strengths: List[str]<br>    gaps: List[str]<br>    recommendation: str</pre><ul><li>Create the plugin:</li></ul><pre>class RoleFitPlugin(ExtractorPlugin):<br>    def __init__(self, role_name=&quot;Software Engineer&quot;):<br>        self.role_name = role_name<br>        super().__init__()<br>    <br>    @property<br>    def metadata(self) -&gt; PluginMetadata:<br>        return PluginMetadata(<br>            name=&quot;role_fit_analyzer&quot;,<br>            version=&quot;1.0.0&quot;,<br>            description=f&quot;Analyzes candidate fit for {self.role_name} role&quot;,<br>            category=PluginCategory.ANALYZER,<br>            author=&quot;Your Name&quot;<br>        )<br>    <br>    def get_model(self) -&gt; Type[BaseModel]:<br>        return RoleFitAssessment<br>    <br>    def get_prompt_template(self) -&gt; str:<br>        return &quot;&quot;&quot;<br>        Based on the resume below, assess the candidate&#39;s fit for a {role_name} position.<br>        Provide a score from 1-10, list key strengths, identify gaps, and make a recommendation.<br>        <br>        {format_instructions}<br>        <br>        Resume Text:<br>        {text}<br>        &quot;&quot;&quot;<br>    <br>    def get_input_variables(self) -&gt; List[str]:<br>        return [&quot;text&quot;, &quot;role_name&quot;]<br>    <br>    def prepare_input_data(self, extracted_text: str) -&gt; Dict[str, Any]:<br>        return {<br>            &quot;text&quot;: extracted_text,<br>            &quot;role_name&quot;: self.role_name<br>        }</pre><ul><li>Register the plugin in custom_plugins/<a href="http://init.py/">init.py</a>:</li></ul><pre>__all__: List[str] = [<br>    &quot;RoleFitPlugin&quot;<br>]</pre><h3>Performance Improvements</h3><p>Beyond the architectural changes, I’ve made several performance optimizations:</p><ol><li>Concurrent Processing: Plugins run in parallel using ThreadPoolExecutor</li><li>Optimized Prompts: Refined prompts to reduce token usage</li><li>Efficient File Handling: Better methods for reading large resume files</li></ol><h3>Conclusion</h3><p>The evolution from a basic resume parser to a flexible, plugin-based parser demonstrates the power of good architecture and modular design. By building on the foundation of LLMs but adding a plugin architecture, we’ve created a system that can grow and adapt to different use cases without requiring changes to the core codebase.</p><p>The plugin-based approach allows users to customize the system to their specific needs, whether that’s analyzing resumes for different roles, extracting additional information, or implementing custom scoring algorithms.</p><p>If you’re interested in implementing or extending this system, the complete code is available on my <a href="https://github.com/Gaurav-Kumar98/CVInsight">GitHub repository</a>. Feel free to fork it, contribute, or adapt it to your own needs!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6cb9328db3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Resume Parser with LLMs: A Step-by-Step Guide — Part I]]></title>
            <link>https://medium.com/@gk0415439/building-a-resume-parser-with-llms-a-step-by-step-guide-part-i-03682a68bc8b?source=rss-6a8574c73386------2</link>
            <guid isPermaLink="false">https://medium.com/p/03682a68bc8b</guid>
            <category><![CDATA[langchain]]></category>
            <category><![CDATA[resume]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[resume-parsing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Gaurav Kumar]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 13:45:47 GMT</pubDate>
            <atom:updated>2025-03-24T14:16:38.914Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building a Resume Parser with LLMs: A Step-by-Step Guide — Part I</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWWOqljfGNYMsXoZY6V1Jw.jpeg" /></figure><p>Have you ever wondered how to build a system that can automatically analyze resumes and extract meaningful information from them? In this post, I’ll walk you through my journey of building a resume analysis system powered by Large Language Models (LLMs).</p><h3>The Problem</h3><p>As a data engineer who’s also been involved in hiring, I understand how labor-intensive it is to manually sift through resumes. Each resume comes in a unique format with varied sections and methods of presenting information. Imagine leveraging automation to transform these diverse documents into structured, actionable data, streamlining the hiring process and enabling data-driven decision-making.</p><h3>The Solution</h3><p>I built a Python-based resume analysis system that:</p><ol><li>Takes PDF resumes as input</li><li>Extracts text from these resumes</li><li>Uses LLMs (specifically Google’s Gemini models) to extract structured information</li><li>Outputs the results in a clean JSON format</li></ol><p>Let me walk you through how I built it.</p><h3>Architecture Overview</h3><p>I designed the system with modularity and extensibility in mind. Here’s the high-level architecture:</p><ul><li>Resume Class: The core data model that stores all the extracted information</li><li>ResumeProcessor: Manages the overall process of analyzing resumes</li><li>BaseExtractor: An abstract base class that defines the interface for all extractors</li><li>Specialized Extractors: Classes that extract specific types of information (profile, skills, education, etc.)</li><li>LLM Service: A centralized service for interacting with language models</li></ul><h3>Step 1: Setting Up the Project Structure</h3><p>First, I set up a clean project structure to organize the code:</p><pre>.<br>├── config.py                # Configuration settings and API keys<br>├── extractors/              # Package for specialized extractors<br>│   ├── __init__.py          # Package exports<br>│   ├── base_extractor.py    # Base class for all extractors<br>│   ├── profile_extractor.py # Profile information extractor<br>│   ├── skills_extractor.py  # Skills extractor<br>│   ├── education_extractor.py # Education extractor<br>│   ├── experience_extractor.py # Work experience extractor<br>│   └── yoe_extractor.py     # Years of experience extractor<br>├── llm_service.py           # Centralized LLM service<br>├── main.py                  # Main application entry point<br>├── models.py                # Pydantic models (including Resume class)<br>├── utils/                   # Utility functions<br>│   ├── __init__.py          # Package exports<br>│   └── common.py            # Common utility functions<br>├── requirements.txt         # Project dependencies<br>└── .env.example             # Example environment variables file</pre><h3>Step 2: Defining Data Models</h3><p>Next, I defined the data models for our application using Pydantic. This gives us type safety and validation out of the box.</p><p>Here’s a simplified version of our Resume model:</p><pre>class Resume(BaseModel):<br>    &quot;&quot;&quot;A complete resume with all extracted information.&quot;&quot;&quot;<br>    # Profile information<br>    name: Optional[str] = None<br>    contact_number: Optional[str] = None<br>    email: Optional[str] = None<br>    <br>    # Skills<br>    skills: List[str] = Field(default_factory=list)<br>    <br>    # Education<br>    educations: List[Education] = Field(default_factory=list)<br>    <br>    # Work Experience<br>    work_experiences: List[WorkExperience] = Field(default_factory=list)<br>    <br>    # Years of Experience<br>    YoE: Optional[str] = None</pre><h3>Step 3: Building the LLM Service</h3><p>The heart of the system is the LLM service, which uses Google’s Gemini models through the LangChain framework:</p><pre>def extract_with_llm(pydantic_model, prompt_template, input_variables, input_data):<br>    &quot;&quot;&quot;<br>    Extract information from text using a language model.<br>    &quot;&quot;&quot;<br>    parser = JsonOutputParser(pydantic_object=pydantic_model)<br>    <br>    prompt = PromptTemplate(<br>        template=prompt_template,<br>        input_variables=input_variables,<br>        partial_variables={&quot;format_instructions&quot;: parser.get_format_instructions()}<br>    )<br>    <br>    llm = get_llm()  # Gets the LLM instance (Gemini)<br>    <br>    chain = prompt | llm | parser<br>    result = chain.invoke(input_data)<br>    <br>    return result</pre><p>This function is the cornerstone of our extraction process. It:</p><ol><li>Creates a JSON output parser based on our Pydantic model</li><li>Formats a prompt template with the input data</li><li>Sends the prompt to the LLM</li><li>Parses the LLM’s response into our Pydantic model</li></ol><h3>Step 4: Creating the Extractor Framework</h3><p>To make the system modular and extensible, I created a base extractor class that all specialized extractors inherit from:</p><pre>class BaseExtractor(ABC):<br>    &quot;&quot;&quot;<br>    Base class for all extractors.<br>    &quot;&quot;&quot;<br>    <br>    @abstractmethod<br>    def get_model(self) -&gt; Type[BaseModel]:<br>        &quot;&quot;&quot;Get the Pydantic model for the extractor.&quot;&quot;&quot;<br>        pass<br>    <br>    @abstractmethod<br>    def get_prompt_template(self) -&gt; str:<br>        &quot;&quot;&quot;Get the prompt template for the extractor.&quot;&quot;&quot;<br>        pass<br>    <br>    @abstractmethod<br>    def process_output(self, output: Any) -&gt; Dict[str, Any]:<br>        &quot;&quot;&quot;Process the output from the LLM.&quot;&quot;&quot;<br>        pass<br>    <br>    def extract(self, extracted_text: str) -&gt; Dict[str, Any]:<br>        &quot;&quot;&quot;Extract information from the resume.&quot;&quot;&quot;<br>        input_data = self.prepare_input_data(extracted_text)<br>        output = llm_service.extract_with_llm(<br>            self.get_model(),<br>            self.get_prompt_template(),<br>            self.get_input_variables(),<br>            input_data<br>        )<br>        return self.process_output(output)</pre><p>This abstract base class defines the interface that all extractors must implement, while providing default implementations for common functionality.</p><h3>Step 5: Implementing Specialized Extractors</h3><p>With the framework in place, I implemented specialized extractors for different types of information:</p><h3>Skills Extractor</h3><pre>class SkillsExtractor(BaseExtractor):<br>    &quot;&quot;&quot;Extractor for skills.&quot;&quot;&quot;<br>    <br>    def get_model(self) -&gt; Type[BaseModel]:<br>        return Skills<br>    <br>    def get_prompt_template(self) -&gt; str:<br>        return &quot;&quot;&quot;<br>You are an assistant that extracts a list of skills mentioned in the text below.<br>Only focus on Skills section of the below text.<br>Return your output as a JSON object with the below schema.<br>{format_instructions}</pre><pre>Text:<br>{text}<br>&quot;&quot;&quot;<br>    <br>    def process_output(self, output: Any) -&gt; Dict[str, Any]:<br>        return self.process_list_output(output, &quot;skills&quot;)</pre><p>The beauty of this approach is that each extractor only needs to define:</p><ol><li>The Pydantic model it uses</li><li>The prompt template specifically designed for its extraction task</li><li>How to process the output</li></ol><p>I implemented similar extractors for profile information, education history, work experience, and years of experience.</p><h3>Step 6: Building the Resume Processor</h3><p>The ResumeProcessor class ties everything together:</p><pre>class ResumeProcessor:<br>    &quot;&quot;&quot;Class for processing resumes and extracting information.&quot;&quot;&quot;<br>    <br>    def __init__(self, resume_dir=&quot;./Resumes&quot;, output_dir=&quot;./Results&quot;):<br>        self.resume_dir = resume_dir<br>        self.output_dir = output_dir<br>        <br>        # Create extractors<br>        self.profile_extractor = ProfileExtractor()<br>        self.skills_extractor = SkillsExtractor()<br>        self.education_extractor = EducationExtractor()<br>        self.experience_extractor = ExperienceExtractor()<br>        self.yoe_extractor = YoeExtractor()</pre><p>The process_resume method is where the magic happens:</p><pre>def process_resume(self, pdf_file_path):<br>    &quot;&quot;&quot;Process a single resume file.&quot;&quot;&quot;<br>    # Extract text from the resume<br>    extracted_text = read_file(pdf_file_path)<br>    <br>    # Extract information concurrently<br>    with concurrent.futures.ThreadPoolExecutor() as executor:<br>        future_profile = executor.submit(self.profile_extractor.extract, extracted_text)<br>        future_skills = executor.submit(self.skills_extractor.extract, extracted_text)<br>        future_education = executor.submit(self.education_extractor.extract, extracted_text)<br>        future_experience = executor.submit(self.experience_extractor.extract, extracted_text)<br>        future_yoe = executor.submit(self.yoe_extractor.extract, extracted_text)<br>        <br>        # Get results<br>        profile = future_profile.result()<br>        skills = future_skills.result()<br>        education = future_education.result()<br>        experience = future_experience.result()<br>        yoe = future_yoe.result()<br>    <br>    # Create a Resume object from the extracted information<br>    resume = Resume.from_extractors_output(<br>        profile, skills, education, experience, yoe, pdf_file_path<br>    )<br>    <br>    return resume</pre><p>I’m using Python’s concurrent.futures to run the extractors in parallel, which significantly speeds up the processing time.</p><h3>Step 7: Running the System</h3><p>Finally, the main.py file brings everything together:</p><pre>def main():<br>    # Set up logging<br>    setup_logging()<br>    <br>    # Create a resume processor<br>    processor = ResumeProcessor(<br>        resume_dir=config.RESUME_DIR,<br>        output_dir=config.OUTPUT_DIR<br>    )<br>    <br>    # Process all resumes<br>    processed_count, error_count = processor.process_all_resumes()<br>    <br>    logging.info(f&quot;Resume processing complete. Processed: {processed_count}, Errors: {error_count}&quot;)</pre><pre>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>The Results</h3><p>The system outputs a JSON file for each resume, containing all the extracted information in a structured format:</p><pre>{<br>  &quot;name&quot;: &quot;John Doe&quot;,<br>  &quot;contact_number&quot;: &quot;+1-123-456-7890&quot;,<br>  &quot;email&quot;: &quot;john.doe@example.com&quot;,<br>  &quot;skills&quot;: [<br>    &quot;Python&quot;,<br>    &quot;Machine Learning&quot;,<br>    &quot;Data Analysis&quot;,<br>    &quot;SQL&quot;,<br>    &quot;JavaScript&quot;<br>  ],<br>  &quot;educations&quot;: [<br>    {<br>      &quot;institution&quot;: &quot;University of Example&quot;,<br>      &quot;start_date&quot;: &quot;2015-09&quot;,<br>      &quot;end_date&quot;: &quot;2019-05&quot;,<br>      &quot;location&quot;: &quot;Boston, MA&quot;,<br>      &quot;degree&quot;: &quot;Bachelor of Science in Computer Science&quot;<br>    }<br>  ],<br>  &quot;work_experiences&quot;: [<br>    {<br>      &quot;company&quot;: &quot;Tech Company Inc.&quot;,<br>      &quot;start_date&quot;: &quot;2019-06&quot;,<br>      &quot;end_date&quot;: &quot;2023-03&quot;,<br>      &quot;location&quot;: &quot;San Francisco, CA&quot;,<br>      &quot;role&quot;: &quot;Software Engineer&quot;<br>    }<br>  ],<br>  &quot;YoE&quot;: &quot;4 years&quot;<br>}</pre><h3>Challenges and Lessons Learned</h3><p>Building this system wasn’t without challenges:</p><ol><li>Prompt Engineering: Getting the right prompts for each extractor was crucial. I had to iterate several times to get the prompts that would reliably extract the information we needed.</li><li>Error Handling: Resumes come in all shapes and sizes, and sometimes the extraction fails. Building robust error handling was essential for a production-ready system.</li><li>Concurrency: Running the extractors in parallel was a significant optimization, but it required careful handling of concurrent API calls.</li><li>Cost Management: LLM API calls aren’t free, so I had to be mindful of the number of calls we were making. Caching common requests helped reduce costs.</li></ol><h3>Future Improvements</h3><p>There are several ways to enhance this system:</p><ol><li>Support for Different Resume Formats: Currently, the system only processes PDF files. Adding support for DOCX, TXT, and other formats would make it more versatile.</li><li>More Extractors: Adding extractors for additional information like projects, certifications, references, and other resume sections would provide more comprehensive analysis.</li><li>Web Interface: Building a web interface for uploading resumes and viewing results would make the system more user-friendly, allowing non-technical users to take advantage of the system.</li><li>Multi-language Support: Currently, the system works best with English resumes. Supporting other languages would make it more versatile for international use.</li></ol><h3>Setting Up the Google Gemini API Key</h3><p>This project uses Google’s Gemini API for natural language processing. Here’s how to get set up with a free API key:</p><ol><li>Visit <a href="https://makersuite.google.com/">Google AI Studio</a></li><li>Sign in with your Google account</li><li>Navigate to the “Get API key” option</li><li>Create a new API key</li><li>Copy the API key and add it to your .env file as GOOGLE_API_KEY</li></ol><h3>Free Tier Limitations</h3><p>Google offers a generous free tier for the Gemini API that’s suitable for testing and small-scale projects. Here’s what you get with the free tier:</p><ul><li>Cost: Input and output tokens are completely free</li><li>Models: Access to models like Gemini 1.5 Flash and Gemini 2.0 Flash</li><li>Rate Limits:</li><li>15 requests per minute (RPM) for Gemini 2.0 Flash</li><li>1,000,000 tokens per minute (TPM)</li><li>1,500 requests per day (RPD)</li></ul><p>For the Resume Analysis system, our implementation reveals actual token usage metrics:</p><ul><li>Average tokens per resume: ~7,700 tokens total</li><li>Token distribution: ~96% prompt tokens, ~4% completion tokens</li></ul><p>With these metrics, the free tier allows processing of:</p><ul><li>Maximum 130 resumes per minute within the token limit (1,000,000 ÷ 7,700)</li><li>Up to 1,500 resumes per day due to the daily request limit</li></ul><p>This is more than adequate for personal use, small businesses, or even medium-sized recruiting operations. Our implementation stores detailed token usage information in separate JSON log files, providing valuable analytics on API consumption while keeping the resume output files clean with only the relevant extracted data.</p><h3>Conclusion</h3><p>Building a resume analysis system with LLMs was a fascinating project that showcases the power of modern AI. By combining the structured approach of object-oriented programming with the natural language understanding capabilities of LLMs, we can create systems that extract meaningful information from unstructured text.</p><p>The modular architecture makes the system easy to extend and maintain, and the use of concurrent processing makes it efficient. Whether you’re a hiring manager looking to streamline your process or a developer interested in applying LLMs to real-world problems, I hope this project provides some inspiration.</p><p>If you’re interested in implementing a similar system, the complete code is available on my <a href="https://github.com/Gaurav-Kumar98/Resume-Analysis">GitHub repository</a>. Feel free to fork it, contribute, or adapt it to your own needs!</p><p>I will be posting more about the future improvements of the project. Stay Tuned!</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03682a68bc8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>