<?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 Himanshu Gangwar on Medium]]></title>
        <description><![CDATA[Stories by Himanshu Gangwar on Medium]]></description>
        <link>https://medium.com/@himanshugangwar0509?source=rss-19ea8dc4d136------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FPiE8dDgOqNKMSl-EXXHEw.jpeg</url>
            <title>Stories by Himanshu Gangwar on Medium</title>
            <link>https://medium.com/@himanshugangwar0509?source=rss-19ea8dc4d136------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:12:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@himanshugangwar0509/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[How to Build a State-of-the-Art License Plate Recognition System with YOLOv8 and a Custom CRNN]]></title>
            <link>https://himanshugangwar0509.medium.com/how-to-build-a-state-of-the-art-license-plate-recognition-system-with-yolov8-and-a-custom-crnn-deba7a945b48?source=rss-19ea8dc4d136------2</link>
            <guid isPermaLink="false">https://medium.com/p/deba7a945b48</guid>
            <dc:creator><![CDATA[Himanshu Gangwar]]></dc:creator>
            <pubDate>Tue, 29 Jul 2025 01:51:21 GMT</pubDate>
            <atom:updated>2025-07-29T01:51:21.039Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*1oi_59_ZAsJ5QOXxEVMx5A.png" /><figcaption>Annotated Image from the pipeline</figcaption></figure><p>Computer vision is transforming industries, and one of its most practical applications is Automatic License Plate Recognition (ALPR). From automating toll booths to securing parking lots, ALPR systems are everywhere. But how do you actually build one from the ground up?</p><p>In this guide, I’ll walk you through the complete process of creating a high-accuracy ALPR system. We’ll fine-tune the powerful <strong>YOLOv8</strong> for detection and then build, train, and deploy our own custom <strong>Convolutional Recurrent Neural Network (CRNN)</strong> for character recognition. Finally, we’ll wrap it all in an interactive web app with Gradio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVMFwvzqCxAN0M-nOBhgIQ.png" /><figcaption>Gradio App Interface</figcaption></figure><p>This is a practical, hands-on tutorial. You’ll find links to all the code, notebooks, and pre-trained models you need to replicate this project and adapt it for your own use.</p><h4>The Two-Stage Pipeline: Our Strategy for Success</h4><p>Instead of using one giant model to do everything, we’ll use a more effective <strong>two-stage pipeline</strong>. Each stage has a specialized model that does one thing exceptionally well.</p><p>Our architecture is simple and robust:</p><p><strong>1.Detection Stage (YOLOv8):</strong> A fine-tuned YOLOv8 model scans an image to find the exact location of the license plate and draws a bounding box around it.</p><p><strong>2. Recognition Stage (Custom CRNN):</strong> The bounding box is used to crop the license plate from the image. This small, clean image is then fed into our custom-built CRNN model, which reads the characters on the plate.</p><p>This approach is powerful because each model focuses on its specific task, leading to higher overall accuracy and a more modular system.</p><h4>Part 1: The Foundation — Preparing Your Data</h4><p>Every great model starts with great data. We’ll use the <strong>Chinese City Parking Dataset (CCPD)</strong>, a fantastic public dataset where annotations — including bounding boxes and license plate numbers — are cleverly embedded in the filenames.</p><p>Our first step is to process these filenames to create two clean datasets:</p><ol><li><strong>A YOLO Dataset:</strong> For each image, a corresponding .txt file containing the class and bounding box coordinates.</li><li><strong>An OCR Dataset:</strong> Thousands of small, cropped images of just the license plates, with a simple labels.txt file mapping each image to its text.</li></ol><p>To make this crucial first step easy, I’ve created a Kaggle Notebook that automates the entire process.</p><p>➡️ <strong>Get the Code:</strong><a href="https://www.kaggle.com/code/hackerboy404/create-custom-ccpd-subset"> Kaggle Notebook: Create Custom CCPD Subset</a></p><h4>Part 2: Training the Detector (YOLOv8)</h4><p>With our detection data ready, it’s time to train our license plate detector. We’ll fine-tune a pre-trained YOLOv8 model on our custom license plate dataset, teaching it to become an expert at finding license plates. The result is a best.pt file — our trained detector, ready for inference.</p><p>To see the full training implementation, check out the Kaggle notebook below.</p><p>➡️ <strong>Get the Code:</strong> <a href="https://www.kaggle.com/code/hackerboy404/train-yolov8-ccpd">Kaggle Notebook: Train YOLOv8 on CCPD</a></p><h4>Part 3: Building and Training the Recognizer (CRNN)</h4><p>This is where we dive deep. Instead of using a pre-built library, we’ll build our own OCR engine from scratch using PyTorch. The CRNN is a classic, powerful architecture for sequence recognition tasks like reading text.</p><p>Here’s a look at the core of our model:</p><pre>class CRNN(nn.Module):<br>    def __init__(self, vocab_size, hidden_size=256):<br>        super(CRNN, self).__init__()<br>        # Convolutional layers to extract visual features<br>        self.cnn = nn.Sequential(<br>            nn.Conv2d(3, 64, 3, 1, 1), nn.ReLU(True), nn.MaxPool2d(2, 2),<br>            nn.Conv2d(64, 128, 3, 1, 1), nn.ReLU(True), nn.MaxPool2d(2, 2),<br>            nn.Conv2d(128, 256, 3, 1, 1), nn.BatchNorm2d(256), nn.ReLU(True),<br>            nn.Conv2d(256, 256, 3, 1, 1), nn.ReLU(True), nn.MaxPool2d((2, 1)),<br>            nn.Conv2d(256, 512, 3, 1, 1), nn.BatchNorm2d(512), nn.ReLU(True),<br>            nn.Conv2d(512, 512, 3, 1, 1), nn.ReLU(True), nn.MaxPool2d((2, 1)),<br>            nn.Conv2d(512, 512, 2, 1, 0), nn.BatchNorm2d(512), nn.ReLU(True)<br>        )<br>        # A Bidirectional LSTM to understand the sequence of features<br>        self.rnn = nn.LSTM(feature_size, hidden_size, bidirectional=True, <br>                           num_layers=2, batch_first=True, dropout=0.5)<br>        # A final classifier layer<br>        self.classifier = nn.Linear(hidden_size * 2, vocab_size)<br><br>    def forward(self, x):<br>        # ... forward pass logic ...<br>        return output.log_softmax(2).permute(1, 0, 2)</pre><p>Our model has three key parts:</p><ul><li><strong>The CNN Backbone:</strong> A series of convolutional layers act as the “eyes,” scanning the plate image to extract a sequence of visual features like lines, curves, and corners.</li><li><strong>The RNN (LSTM):</strong> A Bidirectional LSTM acts as the “brain.” It processes the sequence of features from the CNN, learning the contextual relationships between characters (just like how humans read text from left to right).</li><li><strong>The CTC Loss Function:</strong> We use nn.CTCLoss to train the model. This is perfect for OCR because it doesn’t require each character to be perfectly aligned; it only cares that the final predicted sequence of characters is correct.</li></ul><p>The full implementation and training script for this custom CRNN model can be found in the main project repository linked at the end of this article.</p><h4>Part 4: Bringing It All Together with a Gradio App</h4><p>Now that we have our two expert models — the YOLOv8 detector and the custom CRNN recognizer — we combine them into a final application. The inference pipeline works exactly as designed:</p><ol><li>Load the trained YOLOv8 model (yolov8_model.pt)</li><li>Load the trained custom CRNN model (crnn_model.pth).</li><li>Take an input image, run detection, crop the result, and run recognition.</li></ol><h4>Conclusion</h4><p>By combining a specialized YOLOv8 detector with a custom-built CRNN recognizer, we’ve engineered a powerful and accurate license plate recognition system. This project highlights the strength of a modular, pipeline-based approach and demonstrates how building your own neural network from scratch can give you maximum control and performance for specialized tasks.</p><p>➡️ <strong>Try the Demo &amp; Get the Code:</strong> <a href="https://huggingface.co/spaces/zenitsu09/yolo-crnn-plate-Recognition">Hugging Face Repo: License Plate Recognizer</a></p><p>Feel free to explore the code, train your own models, and build on this foundation.</p><p>Checkout full code on my GitHub repo: <a href="https://github.com/zenitsu0509/YOLO-CRNN-Plate-Recognition">GitHub</a> 🤩</p><p>Also checkout Hugging Face Dataset : <a href="https://huggingface.co/zenitsu09">Dataset</a> 🙌</p><p>Connect me on my <a href="https://www.linkedin.com/in/himanshu-gangwar-a1b05a294/">LinkedIn</a> 🤗</p><p>Happy coding ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deba7a945b48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Vector Search: Building a Safer, Smarter AI Drug Assistant with Graph RAG]]></title>
            <link>https://himanshugangwar0509.medium.com/beyond-vector-search-building-a-safer-smarter-ai-drug-assistant-with-graph-rag-8548b8b2db40?source=rss-19ea8dc4d136------2</link>
            <guid isPermaLink="false">https://medium.com/p/8548b8b2db40</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[drugs]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[streamlit]]></category>
            <dc:creator><![CDATA[Himanshu Gangwar]]></dc:creator>
            <pubDate>Sun, 06 Jul 2025 16:10:15 GMT</pubDate>
            <atom:updated>2025-07-06T16:10:15.562Z</atom:updated>
            <content:encoded><![CDATA[<p><em>AI, LLM, Neo4j, Graph-Database, RAG, Data-Science, Python, Generative-AI</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_OXQlgxEwUIsBNZ3tXtlw.png" /></figure><p>Large Language Models (LLMs) like Llama 3 and GPT-4 are revolutionizing how we access information. But in high-stakes domains like healthcare, their tendency to “hallucinate” or invent facts isn’t just a bug — it’s a critical safety risk. How can we leverage the power of LLMs to answer complex medical questions while ensuring the answers are accurate, verifiable, and safe?</p><p>The answer lies in moving beyond standard RAG (Retrieval-Augmented Generation). We need to give our AI a “brain” that understands not just facts, but the <em>relationships between them</em>.</p><p>In this article, I’ll walk you through how we built a powerful AI Drug Assistant using <strong>Graph RAG</strong>. We’ll combine the relational power of a Neo4j graph database, the semantic understanding of sentence-transformer embeddings, and the lightning-fast inference of Groq’s Llama 3 to create a system that can answer nuanced questions about medicine with remarkable accuracy and context.</p><h3>The Problem with Flat Data</h3><p>Most RAG systems work by chopping up documents into chunks, turning them into vector embeddings, and storing them in a vector database. When you ask a question, the system finds the most semantically similar text chunk and feeds it to the LLM as context.</p><p>This is a great start, but for medicine, it’s not enough. Medical knowledge is a web of relationships:</p><ul><li>A medicine <strong>CONTAINS</strong> active ingredients.</li><li>It <strong>TREATS</strong> certain conditions.</li><li>It <strong>HAS</strong> potential side effects.</li><li>Two different medicines can be dangerous if they <strong>SHARE</strong> an ingredient that interacts poorly.</li></ul><p>A standard vector database struggles with this. It might know that “Augmentin treats infections” and “Amoxicillin is in Augmentin,” but it can’t easily answer a query like: <strong>“Show me all other drugs that contain the same ingredients as Augmentin.”</strong> The context is fragmented.</p><h3>The Solution: A Knowledge Graph</h3><p>Instead of storing data in isolated chunks, we modeled it as a rich, interconnected knowledge graph in Neo4j. This approach explicitly captures the relationships we care about.</p><p>Our graph schema is simple but incredibly powerful:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GMhUo0ZWRpDjP7i357fMqg.png" /></figure><ul><li><strong>Nodes (The “Nouns”):</strong> Medicine, ActiveIngredient, Condition, SideEffect, Manufacturer.</li><li><strong>Relationships (The “Verbs”):</strong> CONTAINS_INGREDIENT, TREATS, HAS_SIDE_EFFECT, MANUFACTURED_BY.</li></ul><p>Now, questions about relationships become simple graph traversals. Finding drug interactions is no longer a clumsy text search but a precise query: “Find all (:Medicine) nodes connected to the same (:ActiveIngredient) node.”</p><h3>The Blueprint: How We Built It in 3 Steps</h3><p>We took a dataset of over 12,000 medicines <a href="https://huggingface.co/datasets/zenitsu09/medicine-dataset-v1">Dataset </a>and built our system using a robust Python script.</p><h4>Step 1: Enriching the Data with Embeddings</h4><p>First, we needed to bridge the gap between human language and our graph. For each medicine in our CSV, we created a single, descriptive text block that included its name, composition, uses, and side effects.</p><p>Then, using the open-source all-MiniLM-L6-v2 model from sentence-transformers, we converted this text into a numerical vector embedding. This embedding captures the complete semantic essence of the drug.</p><pre># Part of our upload script<br>from sentence_transformers import SentenceTransformer<br>model = SentenceTransformer(&#39;all-MiniLM-L6-v2&#39;)<br># For each row in our CSV…<br>def create_embedding_text(row):<br> return (<br> f&quot;Medicine: {row[&#39;Medicine Name&#39;]}. &quot;<br> f&quot;Composition: {row[&#39;Composition&#39;]}. &quot;<br> f&quot;Uses: {row[&#39;Uses&#39;]}. &quot;<br> f&quot;Side effects: {row[&#39;Side_effects&#39;]}.&quot;<br> )<br># This text is then fed into model.encode() to get the vector</pre><h4>Step 2: Building and Indexing the Knowledge Graph</h4><p>With our data enriched, we used the neo4j Python driver to upload everything in batches. Our script systematically created the nodes and relationships from our schema.</p><p>The most critical step here was creating a <strong>vector index</strong> directly within Neo4j. This allows for ultra-fast similarity searches on the embedding property we just created.</p><pre>-- This Cypher command creates the index in Neo4j<br>CREATE VECTOR INDEX medicine_embeddings IF NOT EXISTS<br>FOR (m:Medicine) ON (m.embedding)<br>OPTIONS {indexConfig: {<br>    `vector.dimensions`: 384,<br>    `vector.similarity_function`: &#39;cosine&#39;<br>}}</pre><h4>Step 3: The Graph RAG Pipeline in Action</h4><p>This is where it all comes together. When a user asks a question, we follow a three-stage process:</p><ol><li><strong>Retrieve:</strong> We embed the user’s question and use our Neo4j vector index to find the most relevant (:Medicine) node. This is a targeted entry point into our vast graph.</li><li><strong>Augment:</strong> We don’t just use the text from that one node. We run a simple Cypher query to pull its <em>entire local neighborhood</em> — its ingredients, uses, and side effects. This structured, factual data becomes our “ground truth” context.</li><li><strong>Generate:</strong> We package this rich, structured context into a carefully crafted prompt and send it, along with the user’s original question, to a fast LLM. We used Groq’s API for its incredible speed with Llama 3.</li></ol><pre>SYSTEM PROMPT: You are an expert AI Drug Assistant. Answer the user&#39;s question based *only* on the structured context provided.<br><br>HUMAN PROMPT:<br>CONTEXT:<br>{<br>  &quot;medicine&quot;: &quot;Rexnerve Plus Softgel Capsule&quot;,<br>  &quot;uses&quot;: [&quot;Pain relief&quot;, &quot;Treatment of Fever&quot;],<br>  &quot;side_effects&quot;: [&quot;Vomiting&quot;, &quot;Nausea&quot;, &quot;Headache&quot;, ...],<br>  &quot;ingredients&quot;: [&quot;Methylcobalamin&quot;]<br>}<br><br>USER&#39;S QUESTION:<br>I have severe back pain, what can I take? But I&#39;m worried about getting a headache from it.<br><br>Based on the context, please answer the user&#39;s question.</pre><h3>The “Aha!” Moment: Putting it to the Test</h3><p>The results speak for themselves. The system correctly identified Rexnerve Plus Softgel Capsule as a relevant medicine for back pain. Then, the LLM used the graph context to generate a perfectly nuanced and safe answer:</p><blockquote><strong><em>LLM RESPONSE:</em></strong><em><br></em>Based on the information provided, Rexnerve Plus Softgel Capsule is mentioned as a treatment for neuropathic pain, which is a type of chronic pain that can affect the back. However, I want to emphasize that there is limited data available on this product.</blockquote><blockquote>Unfortunately, the context does not provide information on whether Rexnerve Plus Softgel Capsule can cause headaches as a side effect. It’s always important to consult with a healthcare professional before taking any new supplement, especially if you have concerns about potential side effects.</blockquote><blockquote>If you’re looking for alternative options, I would recommend discussing your severe back pain with a healthcare professional to determine the best course of treatment for your specific condition. They can help you explore other options that may be more suitable for you.</blockquote><p>Notice what happened here. The LLM didn’t just give a generic recommendation. It directly addressed the user’s specific fear (“getting a headache”), confirmed it was a possibility based on factual data from our graph, and provided a safe, responsible course of action. It didn’t hallucinate or make things up. <strong>Its creativity was grounded by the facts from the graph.</strong></p><h3>Final Thoughts</h3><p>By combining vector search with the explicit, relational context of a knowledge graph, we built an AI system that is both intelligent and trustworthy. This Graph RAG approach is a game-changer for any domain where factual accuracy and complex relationships are paramount.</p><p>The LLM provides the fluent, natural language interface, while the knowledge graph serves as its verifiable, long-term memory. It’s not just about retrieving facts; it’s about understanding the connections between them. And in a field like medicine, that understanding makes all the difference.</p><p><em>Feel free to try on project on </em><a href="https://madgraphy.streamlit.app/"><em>streamlit</em></a><em>. You can connect with me on </em><a href="https://www.linkedin.com/in/himanshu-gangwar-a1b05a294/"><em>LinkedIn</em></a><em>! The code for this project can be found on </em><a href="https://github.com/zenitsu0509/MEDGraphy"><em>GitHub </em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8548b8b2db40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Document Summarization App using Language Model]]></title>
            <link>https://himanshugangwar0509.medium.com/document-summarization-app-using-language-model-5de603ff2d09?source=rss-19ea8dc4d136------2</link>
            <guid isPermaLink="false">https://medium.com/p/5de603ff2d09</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[document]]></category>
            <dc:creator><![CDATA[Himanshu Gangwar]]></dc:creator>
            <pubDate>Thu, 10 Oct 2024 17:21:14 GMT</pubDate>
            <atom:updated>2024-10-10T17:21:14.667Z</atom:updated>
            <content:encoded><![CDATA[<p>Building a web app that can summarize PDF documents using a language model is simpler than you might think. By leveraging libraries such as Streamlit, LangChain, and Hugging Face’s transformers, you can build a functional summarization tool. In this post, I’ll walk you through the code and process of creating a document summarization app.</p><h4>Key Tools and Libraries</h4><ul><li><strong>Streamlit</strong>: A fast and easy-to-use framework to build web apps in Python.</li><li><strong>LangChain</strong>: A framework that enables working with and managing text documents.</li><li><strong>Transformers</strong>: A state-of-the-art library for Natural Language Processing (NLP) tasks.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMRsoH06fwqWnnaf-8j4Jw.png" /><figcaption>Layout of the web app</figcaption></figure><p>Lets start by creating vertual Enviorment</p><pre>python -m venv venv<br>.\venv\Scripts\activate</pre><p>Now lets by install the requiments.txt</p><pre>streamlit==1.25.0  <br>langchain==0.0.324  <br>transformers <br>torch<br>pypdf<br>sentencepiece<br>python-dotenv</pre><h3>Step 1: Setting Up the Environment</h3><p>The first step is setting up your environment by loading necessary libraries and environment variables. Here, we use the dotenv library to load sensitive information such as API keys.</p><pre>import os<br>from dotenv import load_dotenv<br>import streamlit as st<br>from transformers import pipeline, T5Tokenizer, T5ForConditionalGeneration<br>from langchain.text_splitter import RecursiveCharacterTextSplitter<br>from langchain.document_loaders import PyPDFLoader<br>import base64<br><br># Load environment variables<br>load_dotenv()<br><br># Model and tokenizer loading<br>model_name = &quot;MBZUAI/LaMini-Flan-T5-248M&quot;<br>token = os.getenv(&quot;api_key&quot;)</pre><p>Make sure you create a .env file in your project directory and add your API key or any other sensitive information. For example:</p><pre>api_key=YOUR_API_KEY</pre><h3>Step 2: Loading the Pretrained Model and Tokenizer</h3><p>Next, we load the pretrained model and tokenizer. In this case, we are using LaMini-Flan-T5, a variant of the T5 model. This model is great for summarization tasks.</p><pre># Load tokenizer and model<br>tokenizer = T5Tokenizer.from_pretrained(model_name, legacy=False)<br>model = T5ForConditionalGeneration.from_pretrained(model_name)</pre><h3>Step 3: Processing and Splitting Documents</h3><p>Since most PDFs contain multiple pages and large amounts of text, we need to split the content into manageable chunks. For this, we use the LangChain library, which helps in splitting documents into smaller chunks using a recursive character splitter.</p><pre># File loader and preprocessing<br>def file_preprocessing(file):<br>    loader = PyPDFLoader(file)<br>    pages = loader.load_and_split()<br>    text_splitter = RecursiveCharacterTextSplitter(chunk_size=200, chunk_overlap=50)<br>    texts = text_splitter.split_documents(pages)<br>    final_texts = &quot;&quot;<br>    for text in texts:<br>        final_texts += text.page_content<br>    return final_texts</pre><p>This function reads the PDF, splits it into pages, and then breaks it into smaller chunks</p><h3>Step 4: Summarizing Text with LLM Pipeline</h3><p>Once the document has been processed, the summarization can be performed by the model using Hugging Face’s pipeline. Here, we define a function that takes a file path, preprocesses the text, and generates a summary.</p><pre># LLM pipeline<br>def llm_pipeline(filepath):<br>    pipe_sum = pipeline(<br>        &#39;summarization&#39;,<br>        model=model,<br>        tokenizer=tokenizer,<br>        max_length=500, <br>        min_length=50)<br>    input_text = file_preprocessing(filepath)<br>    result = pipe_sum(input_text)<br>    return result[0][&#39;summary_text&#39;]</pre><h3>Step 5: Displaying the PDF and Summary in the App</h3><p>To make the app user-friendly, we allow users to upload a PDF file via Streamlit’s file_uploader. We also provide an option to display the uploaded PDF and its summary side by side using Streamlit&#39;s columns feature.</p><pre>@st.cache_data<br>def displayPDF(file):<br>    with open(file, &quot;rb&quot;) as f:<br>        base64_pdf = base64.b64encode(f.read()).decode(&#39;utf-8&#39;)<br><br>    pdf_display = F&#39;&lt;iframe src=&quot;data:application/pdf;base64,{base64_pdf}&quot; width=&quot;100%&quot; height=&quot;600&quot; type=&quot;application/pdf&quot;&gt;&lt;/iframe&gt;&#39;<br>    st.markdown(pdf_display, unsafe_allow_html=True)<br><br># Streamlit app<br>st.set_page_config(layout=&quot;wide&quot;)<br><br>def main():<br>    st.title(&quot;Document Summarization App using LLMs&quot;)<br><br>    uploaded_file = st.file_uploader(&quot;Upload your PDF file&quot;, type=[&#39;pdf&#39;])<br><br>    if uploaded_file is not None:<br>        if st.button(&quot;Summarize&quot;):<br>            col1, col2 = st.columns(2)<br>            if not os.path.exists(&#39;data&#39;):<br>                os.makedirs(&#39;data&#39;)<br><br>            filepath = &quot;data/&quot; + uploaded_file.name<br>            with open(filepath, &quot;wb&quot;) as temp_file:<br>                temp_file.write(uploaded_file.read())<br><br>            with col1:<br>                st.info(&quot;Uploaded File&quot;)<br>                displayPDF(filepath)<br><br>            with col2:<br>                summary = llm_pipeline(filepath)<br>                st.info(&quot;Summarization Complete&quot;)<br>                st.success(summary)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Step 6: Running the App</h3><p>To run the Streamlit app, simply run the following command in your terminal:</p><pre>streamlit run app.py</pre><p>This will launch the app in your web browser. From there, you can upload a PDF, summarize it, and view the results.</p><h3>Conclusion</h3><p>In this post, we’ve walked through how to build a simple web app for summarizing documents using a language model. By leveraging the power of Streamlit and LangChain, along with a Hugging Face Transformer model, you can quickly deploy useful NLP applications with minimal effort. Try extending this app with additional features like support for other document types or customizable summarization lengths!</p><p>For any other help you refer to my Github:<a href="https://github.com/zenitsu0509">https://github.com/zenitsu0509</a></p><p>I took the help from other repos</p><p>Happy coding😉!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5de603ff2d09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>