{"id":258,"date":"2025-11-21T15:21:02","date_gmt":"2025-11-21T15:21:02","guid":{"rendered":"https:\/\/codetypingpro.com\/?p=258"},"modified":"2025-11-21T15:21:02","modified_gmt":"2025-11-21T15:21:02","slug":"41-real-world-python-projects-ai-chat-summarizer","status":"publish","type":"post","link":"https:\/\/codetypingpro.com\/?p=258","title":{"rendered":"41 &#8211; Real-World Python Projects &#8211; AI Chat Summarizer"},"content":{"rendered":"\n<h6 class=\"wp-block-heading\"><\/h6>\n\n\n\n<p>This project creates an AI system that:<\/p>\n\n\n\n<p>\u2714 Reads long chat conversations<br>\u2714 Automatically summarizes key points<br>\u2714 Extracts decisions, tasks, and action items<br>\u2714 Highlights important messages<br>\u2714 Exports the summary<br>\u2714 Works with chat files (WhatsApp, Telegram, Teams, Slack, Messenger)<\/p>\n\n\n\n<p>This is extremely useful for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Meeting summaries<\/li>\n\n\n\n<li>Customer support chat logs<\/li>\n\n\n\n<li>WhatsApp group archives<\/li>\n\n\n\n<li>Telegram export files<\/li>\n\n\n\n<li>Long AI discussion threads<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83e\udde0 <strong>What You Will Build<\/strong><\/h1>\n\n\n\n<p>Your AI Chat Summarizer will:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Allow user to upload a chat\/text file<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Clean and preprocess conversation<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Run AI summarization<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Generate bullet points + detailed summary<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Identify key action items<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Display summary in UI (Streamlit)<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 Export summary as PDF or TXT<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83e\uddf0 <strong>Tech Stack<\/strong><\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Python<\/li>\n\n\n\n<li>Transformers (HuggingFace) or GPT API<\/li>\n\n\n\n<li>Streamlit (dashboard UI)<\/li>\n\n\n\n<li>Pandas<\/li>\n\n\n\n<li>NLTK\/TextBlob (optional cleaning)<\/li>\n\n\n\n<li>pypdf (optional PDF export)<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udcc1 Folder Structure<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>AIChatSummarizer\/\n\u2502\u2500\u2500 app.py\n\u2502\u2500\u2500 summarizer.py\n\u2502\u2500\u2500 requirements.txt\n\u2502\u2500\u2500 sample_chat.txt\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udce6 requirements.txt<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>streamlit\ntransformers\ntorch\npandas\nnltk\n<\/code><\/pre>\n\n\n\n<p>Install:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install -r requirements.txt\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83e\udde9 <strong>Full Working Code \u2014 summarizer.py<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>from transformers import pipeline\n\nsummarizer = pipeline(\"summarization\", model=\"facebook\/bart-large-cnn\")\n\ndef clean_text(text):\n    lines = text.split(\"\\n\")\n    cleaned = &#91;line for line in lines if line.strip() != \"\"]\n    return \" \".join(cleaned)\n\ndef summarize_chat(text, max_len=200):\n    text = clean_text(text)\n\n    summary = summarizer(\n        text,\n        max_length=max_len,\n        min_length=80,\n        do_sample=False\n    )&#91;0]&#91;'summary_text']\n\n    return summary\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83e\udde9 <strong>Streamlit App (app.py)<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>import streamlit as st\nfrom summarizer import summarize_chat\n\nst.title(\"AI Chat Summarizer\")\nst.write(\"Upload any chat log to automatically generate a summary.\")\n\nfile = st.file_uploader(\"Upload chat file (.txt)\", type=&#91;'txt'])\n\nif file:\n    text = file.read().decode(\"utf-8\")\n    st.subheader(\"Original Chat Preview\")\n    st.text(text&#91;:1000] + \" ...\")\n\n    if st.button(\"Generate Summary\"):\n        with st.spinner(\"Summarizing...\"):\n            summary = summarize_chat(text)\n\n        st.success(\"Summary Generated\")\n        st.subheader(\"Chat Summary\")\n        st.write(summary)\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\u25b6 Run the dashboard<\/h1>\n\n\n\n<pre class=\"wp-block-code\"><code>streamlit run app.py<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This project creates an AI system that: \u2714 Reads long chat conversations\u2714 Automatically summarizes key points\u2714 Extracts decisions, tasks, and action items\u2714 Highlights important messages\u2714 Exports the summary\u2714 Works with chat files (WhatsApp, Telegram, Teams, Slack, Messenger) This is extremely useful for: \ud83e\udde0 What You Will Build Your AI Chat Summarizer will: \u2714 Allow user [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258"}],"version-history":[{"count":1,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codetypingpro.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}