<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Yash Jivani</title>
    <description>The latest articles on Forem by Yash Jivani (@jivaniyash).</description>
    <link>https://forem.com/jivaniyash</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1682667%2F38a900ef-b06a-44bb-ac62-840889b44fc8.png</url>
      <title>Forem: Yash Jivani</title>
      <link>https://forem.com/jivaniyash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jivaniyash"/>
    <language>en</language>
    <item>
      <title>React-Poem-Finder-App</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Fri, 06 Jun 2025 01:19:37 +0000</pubDate>
      <link>https://forem.com/jivaniyash/react-poem-finder-app-2i3o</link>
      <guid>https://forem.com/jivaniyash/react-poem-finder-app-2i3o</guid>
      <description>&lt;h1&gt;
  
  
  React-Poem-Finder-App
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Quick Start
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/jivaniyash/react-poem-finder-app.git
&lt;span class="nb"&gt;cd &lt;/span&gt;react-poem-finder-app
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
Overview

&lt;ul&gt;
&lt;li&gt;Features&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Getting Started

&lt;ul&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;Installation&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

Usage

&lt;ul&gt;
&lt;li&gt;Deployment&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;This Project is built using React + Vite Application. It helps users to find &amp;amp; search poems quickly by typing keywords in the search bar. &lt;br&gt;
Check out &lt;a href="https://dgmca1q0tkf1c.cloudfront.net" rel="noopener noreferrer"&gt;Project&lt;/a&gt; at CloudFront Link.&lt;br&gt;
Check out the demo at &lt;a href="https://raw.githubusercontent.com/jivaniyash/react-poem-finder-app/refs/heads/main/demo/demo.gif" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qd9kp3t8fa5ouozavrh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8qd9kp3t8fa5ouozavrh.png" alt="Demo" width="800" height="618"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Overlays&lt;/em&gt; - are used to show/hide the metadata of the poem&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Search Bar&lt;/em&gt; - to filter the Poems by title/content, sorted by Ascending Order &amp;amp; by title first (Searchable across EN &amp;amp; GU languages)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Pagination&lt;/em&gt; - to change the display of poems in a single page &amp;amp; Page Navigation at the bottom of the Screen&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Language&lt;/em&gt; - toggle to change the default global language and poem-level toggle&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Highlighter&lt;/em&gt; - to show the query search in the poem&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;git&lt;/li&gt;
&lt;li&gt;Node.js (18 or later)&lt;/li&gt;
&lt;li&gt;npm&lt;/li&gt;
&lt;li&gt;Vite (&lt;code&gt;npm install -g vite&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;AWS Account (with sufficient permissions to create &amp;amp; add files to an S3 Bucket)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clone the Repository&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/jivaniyash/react-poem-finder-app.git
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Navigate to the project directory:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;react-poem-finder-app
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Install dependencies&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Test on Local Machine&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This will start the App @ &lt;code&gt;http://localhost:5173&lt;/code&gt;. You can remove the &lt;a href="//vite.config.js"&gt;configuration&lt;/a&gt; - &lt;code&gt;host: true&lt;/code&gt; from the server parameter to disable access from other users on the same network &lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Build the App&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This will generate a new &lt;code&gt;dist&lt;/code&gt; directory at the root level. &lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Preview Production Build Locally&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run preview
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;This will start the App @ &lt;code&gt;http://localhost:4173&lt;/code&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;There are two options to deploy the React app: either using an S3 website endpoint or CloudFront, with the connection secured.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploy App in AWS S3 Bucket and access via S3 public link
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create an S3 Bucket with the uncheck Block all public access option to allow Public Access &lt;/li&gt;
&lt;li&gt;Once Bucket is created, navigate to the Properties tab &amp;amp; Enable Static website hosting &lt;/li&gt;
&lt;li&gt;Specify the default page of the website -&lt;code&gt;index.html&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Upload all the contents from the &lt;code&gt;dist&lt;/code&gt; directory to the S3 Bucket&lt;/li&gt;
&lt;li&gt;Open the Bucket website endpoint - &lt;code&gt;http://bucket-name.s3-website-region.amazonaws.com/&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Deploy App in AWS S3 Bucket and access via AWS CloudFront
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create an S3 Bucket with the &lt;code&gt;Block all public access option&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To configure a secure HTTPS connection, create a CloudFront distribution, configuring the domain from the S3 Bucket&lt;/li&gt;
&lt;li&gt;Select Origin access control(OAC) settings &amp;amp; create OAC to allow Bucket access for CloudFront&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;Redirect HTTP to HTTPS&lt;/code&gt; &amp;amp; optional caching and domain settings&lt;/li&gt;
&lt;li&gt;Set the &lt;em&gt;root object&lt;/em&gt; as &lt;code&gt;index.html&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Copy &amp;amp; Paste the Policy of the OAC to the S3 Bucket&lt;/li&gt;
&lt;li&gt;Open the CloudFront Website Endpoint - &lt;a href="https://id.cloudfront.net/" rel="noopener noreferrer"&gt;https://id.cloudfront.net/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AWS Deployment using &lt;a href="//.github/workflows/deploy.yml"&gt;deploy.yml&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create Access keys &amp;amp; Access Token from IAM User Console&lt;/li&gt;
&lt;li&gt;Open GitHub Repository Settings -&amp;gt; Under Security -&amp;gt; secrets and variables -&amp;gt; Actions -&amp;gt; Repository secrets&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;S3_BUCKET_NAME&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;CLOUDFRONT_DISTRIBUTION_ID&lt;/code&gt; # if App is deployed to CloudFront for removing cache&lt;/li&gt;
&lt;li&gt;Change GitHub Repository's &lt;code&gt;Code and automation&lt;/code&gt; Settings -&amp;gt; Branches&lt;/li&gt;
&lt;li&gt;Add a Branch protection rule to allow the deploy.yml file to run when new changes are pulled from a feature branch using Pull Requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Steps for Fresh Start
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Run the following commands for a fresh start of the Project&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm create vite@latest my-project &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;--template&lt;/span&gt; react
&lt;span class="nb"&gt;cd &lt;/span&gt;my-project                 
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Customize the directory and files to add/alter/remove the files for a particular use case&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Check out more at my &lt;a href="https://github.com/jivaniyash/react-poem-finder-app" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>s3</category>
      <category>cloudfront</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Redirecting YouTube Video: Watch Page to Embed View</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Sat, 31 May 2025 19:14:22 +0000</pubDate>
      <link>https://forem.com/jivaniyash/redirecting-youtube-video-watch-page-to-embed-view-beg</link>
      <guid>https://forem.com/jivaniyash/redirecting-youtube-video-watch-page-to-embed-view-beg</guid>
      <description>&lt;h2&gt;
  
  
  Youtube-Embed-Redirector-Extension
&lt;/h2&gt;

&lt;p&gt;This project helps a workaround for YouTube viewers to redirect the YouTube default video view to the Embed view (&lt;strong&gt;Full Screen&lt;/strong&gt;) on Browsers. This helps users avoid any distractions from YouTube suggestions or ads. This extension works as described only with &lt;strong&gt;YouTube Videos and Playlists&lt;/strong&gt; &amp;amp; does not affect YouTube Shorts Videos. &lt;/p&gt;

&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbfa3ez2rmdjw9u9h5bh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbfa3ez2rmdjw9u9h5bh.gif" alt="Demo" width="600" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to activate the Extension
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Pull this repository or Download files as a Zip file &amp;amp; unzip it.&lt;/li&gt;
&lt;li&gt;Open the Browser's Extension Page. For Google Chrome - Please type in the URL bar - &lt;code&gt;chrome://extensions&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Turn on the &lt;code&gt;Developer Mode&lt;/code&gt; toggle button if turned off.
&lt;/li&gt;
&lt;li&gt;Click on the &lt;code&gt;Load Unpacked&lt;/code&gt; Button.&lt;/li&gt;
&lt;li&gt;Choose the directory where this git repository is downloaded or cloned.&lt;/li&gt;
&lt;li&gt;Ignore any errors in the extension page.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the &lt;code&gt;https://www.youtube.com/&lt;/code&gt; and choose the video you want to play&lt;/li&gt;
&lt;li&gt;The browser tab will redirect the YouTube watch page to the embed video format in full-screen view.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Additional Configuration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Currently, there is an additional URL parameter - &lt;code&gt;rel=0&lt;/code&gt; added to the &lt;a href="https://github.com/jivaniyash/YouTube-Embed-Redirector-Extension/blob/main/background.js" rel="noopener noreferrer"&gt;background.js&lt;/a&gt; script, which shows the video suggestions only from the current YouTube Channel during &lt;strong&gt;Play/Pause Mode&lt;/strong&gt; &amp;amp; &lt;strong&gt;End of Video&lt;/strong&gt;. Check out &lt;a href="https://developers.google.com/youtube/player_parameters#release_notes_08_23_2018" rel="noopener noreferrer"&gt;Youtube API&lt;/a&gt; documentation for additional configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out my GitHub Repository - &lt;a href="https://github.com/jivaniyash/YouTube-Embed-Redirector-Extension" rel="noopener noreferrer"&gt;YouTube-Embed-Redirector-Extension&lt;/a&gt;&lt;/p&gt;

</description>
      <category>youtube</category>
      <category>personal</category>
      <category>fun</category>
      <category>ads</category>
    </item>
    <item>
      <title>Serverless Data Ingestion Pipeline using AWS Lambda, S3 &amp; RDS</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Wed, 28 May 2025 22:31:57 +0000</pubDate>
      <link>https://forem.com/jivaniyash/api-data-flow-using-aws-lambda-s3-rds-f8a</link>
      <guid>https://forem.com/jivaniyash/api-data-flow-using-aws-lambda-s3-rds-f8a</guid>
      <description>&lt;h2&gt;
  
  
  CMS API Data Processing using AWS Lambda, S3 &amp;amp; RDS
&lt;/h2&gt;

&lt;p&gt;CMS (Centers for Medicare &amp;amp; Medicaid Services) &lt;a href="https://data.cms.gov/provider-summary-by-type-of-service/medicare-part-d-prescribers/medicare-part-d-prescribers-by-provider-and-drug/api-docs" rel="noopener noreferrer"&gt;API&lt;/a&gt; provides information on prescription drugs provided to Medicare beneficiaries enrolled in Part D (Prescription Drug Coverage), by physicians and other health care providers, aggregated by provider and drug in the US.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Scope
&lt;/h3&gt;

&lt;p&gt;For this project, 2023 Year records are used from the cms database. This project showcases how different AWS Services are configured &amp;amp; provisioned to follow AWS best security practices to allow for least privilege by assigning IAM Roles &amp;amp; Policies  &lt;/p&gt;

&lt;h3&gt;
  
  
  Data Flow Steps
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdf1z3aqm5rne7qhc3ux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdf1z3aqm5rne7qhc3ux.png" alt="Architecture Diagram" width="800" height="619"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Following are the steps AWS Services follow - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;LambdaA runs the Python scripts to fetch the CMS Data using the CMS API and stores it in an S3 bucket (cms-2023-project)&lt;/li&gt;
&lt;li&gt;S3 Bucket has an Event Notification triggered, which is configured to run LambdaB once a new object is uploaded successfully in the S3 bucket with the predefined prefix &amp;amp; suffix set for the key name &lt;/li&gt;
&lt;li&gt;LambdaB, which is under the Private subnet, follows the steps -

&lt;ul&gt;
&lt;li&gt;Connects to S3 using a VPC Endpoint&lt;/li&gt;
&lt;li&gt;Retrieves the raw data from the triggered Event Notification&lt;/li&gt;
&lt;li&gt;Connect to RDS MySQL Database Instance&lt;/li&gt;
&lt;li&gt;Create the Table if it doesn't exist &amp;amp; store the data&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Additional Notes -
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;LambdaB &amp;amp; RDS Spans to MultiAZ for High Availability (us-east-1a &amp;amp; us-east-1b) (Not shown in Diagram)&lt;/li&gt;
&lt;li&gt;LambdaB &amp;amp; RDS are associated with different security groups to talk to AWS Services securely&lt;/li&gt;
&lt;li&gt;Since RDS is placed inside a private subnet, LambdaB needs to be placed inside a VPC&lt;/li&gt;
&lt;li&gt;IAM Policies are created to allow Lambda A &amp;amp; B to connect with S3 &amp;amp; RDS and are attached to IAM Roles&lt;/li&gt;
&lt;li&gt;VPC Endpoint is configured to allow target S3 requests&lt;/li&gt;
&lt;li&gt;Route Tables are associated with Private Subnets&lt;/li&gt;
&lt;li&gt;Inbound &amp;amp; Outbound rules are set to receive incoming &amp;amp; outgoing traffic to services inside the Security groups&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Project Steps:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a VPC with 2 Private Subnets &amp;amp; 2 Security Groups and configure firewall rules (Inbound &amp;amp; Outbound)&lt;/li&gt;
&lt;li&gt;Create a VPC Endpoint using the S3 Gateway service&lt;/li&gt;
&lt;li&gt;Create a S3 Bucket to store data &amp;amp; allow permissions &amp;amp; configure Event Notification&lt;/li&gt;
&lt;li&gt;Create LambdaA &amp;amp; LambdaB &amp;amp; follow instructions @ &lt;a href="https://github.com/jivaniyash/cms-data-aws/blob/daec2b58d8f9c65d3f7e30f44b02f57511928e4c/lambdaA/Instructions.md" rel="noopener noreferrer"&gt;lambdaA&lt;/a&gt; &amp;amp; &lt;a href="https://github.com/jivaniyash/cms-data-aws/blob/daec2b58d8f9c65d3f7e30f44b02f57511928e4c/lambdaB/Instructions.md" rel="noopener noreferrer"&gt;lambdaB&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create RDS Instance, configuring MySQLDB Engine, Credentials, Storage &amp;amp; Instance &amp;amp; Connectivity&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Find More information in my GitHub Repository - &lt;a href="https://github.com/jivaniyash/cms-data-aws" rel="noopener noreferrer"&gt;cms-data-aws&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudcomputing</category>
      <category>medical</category>
      <category>data</category>
    </item>
    <item>
      <title>Smart Waste Solutions: Integrating AI in Next-Gen Waste Sorting</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Fri, 30 Aug 2024 03:08:55 +0000</pubDate>
      <link>https://forem.com/jivaniyash/smart-waste-solutions-integrating-ai-in-next-gen-waste-sorting-ojc</link>
      <guid>https://forem.com/jivaniyash/smart-waste-solutions-integrating-ai-in-next-gen-waste-sorting-ojc</guid>
      <description>&lt;p&gt;Have you ever thought of using AI to sort your customer's waste? There are many companies &amp;amp; waste management contractors in the market globally who want to maximize recycling and save the environment. But, the main problem is people tend to throw the waste in the bin they want or nearest to them, regardless of waste signs &amp;amp; symbols located on bins. Some of the key reasons are people: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;are unaware of the categories (usually there is a variation of categories)&lt;/li&gt;
&lt;li&gt;don't know which waste is classified under what category&lt;/li&gt;
&lt;li&gt;don't have time to think/wait&lt;/li&gt;
&lt;li&gt;and many more... &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Due to the unsorted waste collection at the source, it becomes difficult for the recycling facility to sort 100% accurately. This blog shows the procedure of setting up the system (hardware &amp;amp; software) at/near waste collection bins. &lt;/p&gt;

&lt;h2&gt;
  
  
  Hardware Requirements
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Raspberry Pi&lt;/li&gt;
&lt;li&gt;Camera&lt;/li&gt;
&lt;li&gt;Arduino Uno&lt;/li&gt;
&lt;li&gt;Breadboard&lt;/li&gt;
&lt;li&gt;Wires &amp;amp; LED Lights&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Software Requirements
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Arduino IDE&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Steps.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Configure Raspberry Pi Setup - &lt;a href="https://www.raspberrypi.com/documentation/computers/getting-started.html" rel="noopener noreferrer"&gt;Getting started - Raspberry Pi Documentation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Install Python if not installed.&lt;/li&gt;
&lt;li&gt;SSH your Raspberry Pi into your local system or connect with HDMI display, keyboard &amp;amp; mouse to set up the system. &lt;em&gt;This is only required once&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Create a Project Directory. Create Python Virtual Env.&lt;/li&gt;
&lt;li&gt;Install packages required for running the inference. You can run the trained model Inference. This document is not meant to explain &lt;a href="https://docs.ultralytics.com/modes/train/" rel="noopener noreferrer"&gt;Ultralytics YOLO model training&lt;/a&gt; &amp;amp; various ways of optimizing inferences for your custom use-cases &amp;amp; requirements using &lt;a href="https://inference.roboflow.com/" rel="noopener noreferrer"&gt;Roboflow&lt;/a&gt; or &lt;a href="https://docs.ultralytics.com/hub/inference-api/" rel="noopener noreferrer"&gt;Ultralytics HUB Inference &lt;/a&gt;. The Waste Category Predictor (AI Model) predicts the waste type and sends the signal to Arduino.&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://www.makeuseof.com/how-to-install-and-run-arduino-ide-on-raspberry-pi/" rel="noopener noreferrer"&gt;Arduino IDE&lt;/a&gt; in Raspberry Pi.&lt;/li&gt;
&lt;li&gt;Connect your &lt;a href="https://roboticsbackend.com/arduino-led-complete-tutorial/" rel="noopener noreferrer"&gt;Arduino with Baseboard&lt;/a&gt; &amp;amp; Setup the led lights. Based on the custom blinking you want for each port, Send the Code to the Arduino system. Remember the custom serial constant you set for each LED light.&lt;/li&gt;
&lt;li&gt;Install pyserial package and &lt;a href="https://projecthub.arduino.cc/ansh2919/serial-communication-between-python-and-arduino-663756" rel="noopener noreferrer"&gt;connect&lt;/a&gt; your app with LED using serial commands. &lt;/li&gt;
&lt;li&gt;Now, you are all set, once you connect the camera with the Raspberry Pie, Run the Python App.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some of the steps to configure in VS code are elaborated on at the end of this blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The user approaches the bin to dispose of the waste item. &lt;/li&gt;
&lt;li&gt;When the user points the waste item to the camera, then live video frames are sent to the Raspberry where the Python Code is running. &lt;/li&gt;
&lt;li&gt;AI model predicts the waste type &amp;amp; categorizes it. &lt;/li&gt;
&lt;li&gt;Based on the classified waste, the response is sent back to the LED light (installed on top of the bin) so the user can get guided where s/he has to throw the waste based on the Light color.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Generally, Raspberry Pi has less computing power affecting the prediction. To tackle this problem, Connect &lt;a href="https://docs.ultralytics.com/guides/coral-edge-tpu-on-raspberry-pi/" rel="noopener noreferrer"&gt;Coral Edge TPU&lt;/a&gt; with Raspberry Pi if you want to run locally. Otherwise, you can connect your camera live streams to the remote server (running either in GCP/AWS/Azure or any other cloud computing platform) using a WiFi connection &lt;em&gt;(Make sure you set up proper authentication, making your system secure)&lt;/em&gt;. &lt;br&gt;
This blog doesn't provide Python code &amp;amp; Arduino js code. But if you want to learn more, feel free to &lt;a href="https://www.linkedin.com/in/jivaniyash/" rel="noopener noreferrer"&gt;connect&lt;/a&gt; with me. I would help you set up the configuration &amp;amp; happy to work on building projects like these.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Steps to Install Packages in Raspberry Pi&lt;/span&gt;
&lt;span class="gu"&gt;## 1. Create &amp;amp; Activate Virtualenv, Install Dependencies&lt;/span&gt;

python3 -m venv .venv
.&lt;span class="se"&gt;\.&lt;/span&gt;venv&lt;span class="se"&gt;\S&lt;/span&gt;cripts&lt;span class="se"&gt;\a&lt;/span&gt;ctivate
pip install -r .&lt;span class="se"&gt;\r&lt;/span&gt;equirements.txt

yolo predict model=yolov8s.pt source=0 show=True

&lt;span class="gh"&gt;# Steps YOLO&lt;/span&gt;

&lt;span class="gu"&gt;## With using Docker&lt;/span&gt;
&lt;span class="gu"&gt;### Install Docker&lt;/span&gt;
sudo apt update
sudo apt upgrade -y

sudo reboot

&lt;span class="gu"&gt;### Install Docker on Raspberry Pi&lt;/span&gt;

curl -sSL https://get.docker.com | sh

cd ./
Pull &amp;amp; Run docker image

t=ultralytics/ultralytics:latest-arm64 &amp;amp;&amp;amp; sudo docker pull $t &amp;amp;&amp;amp; sudo docker run -it --ipc=host $t

&lt;span class="gu"&gt;## Without using docker&lt;/span&gt;

&lt;span class="gu"&gt;### 1.Create a directory&lt;/span&gt;

mkdir waste_sorter

&lt;span class="gu"&gt;### 2. Create &amp;amp; Activate Virtualenv, Install Dependencies&lt;/span&gt;
sudo apt update
sudo apt install python3-pip -y
pip install -U pip

python3 -m venv .venv
.&lt;span class="se"&gt;\.&lt;/span&gt;venv&lt;span class="se"&gt;\S&lt;/span&gt;cripts&lt;span class="se"&gt;\a&lt;/span&gt;ctivate
pip install -r .&lt;span class="se"&gt;\r&lt;/span&gt;equirements.txt

https://docs.ultralytics.com/guides/raspberry-pi/#start-without-docker&lt;span class="sb"&gt;


&lt;/span&gt;pip install ultralytics[export]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# test.py to test Led light configuration
# You need to adjust the code as per your requirements
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;

&lt;span class="n"&gt;ser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;serial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Serial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/dev/ttyACM0&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;baudrate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;9600&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;start_led&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;Lit Led light for 1 sec &amp;amp; Dim it for n times&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;start_led function - Command D&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;D&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;start_led&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;It&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s A, class 0&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;It&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s B, class 1&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="s"&gt;It&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s C, class 2&lt;/span&gt;&lt;span class="sh"&gt;'''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;C&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;


&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;command_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Please Enter Command - 0 for blue, 1 for yellow, 2 for green :&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command_input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nb"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Error Occured :&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Please enter a valid command&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;b&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;C&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ai</category>
      <category>computervision</category>
      <category>raspberrypi</category>
      <category>wastesorter</category>
    </item>
    <item>
      <title>Langchain Chat Assistant using Chainlit App</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Wed, 21 Aug 2024 17:13:41 +0000</pubDate>
      <link>https://forem.com/jivaniyash/langchain-chat-assistant-using-chainlit-app-2j5a</link>
      <guid>https://forem.com/jivaniyash/langchain-chat-assistant-using-chainlit-app-2j5a</guid>
      <description>&lt;p&gt;Hey there! If you're excited about building your own AI assistant using Langchain and Chainlit, you're in the right place. In this post, I'll walk you through the steps to set up a simple yet powerful AI assistant. Let’s dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F97djklhid4fn6241t297.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F97djklhid4fn6241t297.gif" alt="This is Video Demo recording." width="600" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps to Configure
&lt;/h2&gt;

&lt;p&gt;Follow these steps to configure the app on your machine!&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Clone Git Repo
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/jivaniyash/langchain-chat-assistant.git
&lt;span class="nb"&gt;cd&lt;/span&gt; ./langchain-chat-assistant
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Create &amp;amp; Activate Virtual Env
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;python3.11-venv
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv .venv
&lt;span class="nb"&gt;source&lt;/span&gt; ./.venv/bin/activate
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; pip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Install Packages
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;chainlit langchain_openai langchain
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Run the script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;chainlit run ./app/main_openai.py &lt;span class="nt"&gt;-w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-w&lt;/code&gt; flag to enable auto-reloading&lt;/p&gt;

&lt;p&gt;This will open a web browser automatically. If not, please copy this link - &lt;a href="http://localhost:8000" rel="noopener noreferrer"&gt;localhost:8000&lt;/a&gt; into the web browser.&lt;/p&gt;




&lt;h2&gt;
  
  
  Customize
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now, you can customize your app to specific use cases by changing System Prompt from &lt;code&gt;./utils/systemPrompt.md&lt;/code&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add New Functions to tailor your use-cases from &lt;code&gt;./utils/functions.py&lt;/code&gt;. Also, if you need to connect using local database, csv, or Excel or any other data files; add those files under &lt;code&gt;./assests/&lt;/code&gt; directory. &lt;code&gt;fetchFromLocalDB&lt;/code&gt; function explains how to configure adding new data sources.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Run Local LLM using OLLAMA APIs
&lt;/h2&gt;

&lt;p&gt;If you want to run your assistant using local LLM running in OLLAMA, please follow &lt;a href="https://github.com/jivaniyash/langchain-chat-assistant/blob/main/README-ollama.md" rel="noopener noreferrer"&gt;these&lt;/a&gt; steps.&lt;/p&gt;

&lt;p&gt;And there you have it! You can now build and run your own AI assistant using OpenAI or OLLAMA. Enjoy exploring the possibilities!&lt;/p&gt;

&lt;p&gt;Please look at my &lt;a href="https://github.com/jivaniyash/langchain-chat-assistant/" rel="noopener noreferrer"&gt;GitHub Repo&lt;/a&gt; to get a glance over the files.&lt;/p&gt;

</description>
      <category>langchain</category>
      <category>openai</category>
      <category>ollama</category>
      <category>chainlit</category>
    </item>
    <item>
      <title>From Stamped to Clean: Transforming Watermarked Images into Clear Visuals</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Fri, 16 Aug 2024 14:31:01 +0000</pubDate>
      <link>https://forem.com/jivaniyash/from-stamped-to-clean-transforming-watermarked-images-into-clear-visuals-24fp</link>
      <guid>https://forem.com/jivaniyash/from-stamped-to-clean-transforming-watermarked-images-into-clear-visuals-24fp</guid>
      <description>&lt;p&gt;Have you wondered how you can remove watermarks from images using Python? It's very simple! You should know Python and have a basic knowledge of computer vision models like CNN &amp;amp; TensorFlow DL framework to follow architectures if you are interested!! Please make sure that you read the copyright laws of the images you want to remove watermarks before you run the code.&lt;/p&gt;




&lt;h3&gt;
  
  
  Steps to follow -
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Create a new &lt;strong&gt;Google Colab notebook&lt;/strong&gt;. Change the runtime to T4 GPU to enhance computing power to run the inference pipeline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Install Conda packages, create and activate the Conda environment&lt;br&gt;
Since Google Colab uses the latest Tensorflow &amp;amp; Python versions and this project uses &lt;code&gt;tensorflow=1.15.0&lt;/code&gt; which is supported by Python 3.6, install miniconda inside the Colab environment&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# set pythonpath
&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt; &lt;span class="n"&gt;PYTHONPATH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="c1"&gt;# /env/python
&lt;/span&gt;
&lt;span class="c1"&gt;# Set up miniconda and set the path '/usr/local'
&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;wget&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;anaconda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;miniconda&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Miniconda3&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py38_4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;12.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Linux&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sh&lt;/span&gt;
&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;chmod&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="n"&gt;Miniconda3&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py38_4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;12.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Linux&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sh&lt;/span&gt;
&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;Miniconda3&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;py38_4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;12.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Linux&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;x86_64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;usr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;/usr/local/lib/python3.8/site-packages&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# create a new conda environment using Python 3.3
&lt;/span&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;create&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="n"&gt;myenv&lt;/span&gt; &lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;3.6&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.Install Packages inside Env.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;shell&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$(conda shell.bash hook)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;activate&lt;/span&gt; &lt;span class="n"&gt;myenv&lt;/span&gt;
&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="mf"&gt;1.15&lt;/span&gt; &lt;span class="n"&gt;pillow&lt;/span&gt; &lt;span class="n"&gt;opencv&lt;/span&gt; &lt;span class="n"&gt;matplotlib&lt;/span&gt; &lt;span class="n"&gt;pyyaml&lt;/span&gt;
&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="n"&gt;tensorflow&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;gpu&lt;/span&gt;

&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;upgrade&lt;/span&gt; &lt;span class="n"&gt;pip&lt;/span&gt;
&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;git&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;JiahuiYu&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;neuralgym&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.Clone Repo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="err"&gt;!&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="n"&gt;clone&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;github&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;zuruoke&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;watermark&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;removal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.Download Model Files from &lt;a href="https://drive.google.com/drive/folders/1xRV4EdjJuAfsX9pQme6XeoFznKXG0ptJ?usp=sharing" rel="noopener noreferrer"&gt;drive&lt;/a&gt; and paste them into the &lt;code&gt;/watermark-removal/model&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;6.Execute Python code to remove the watermark from your istock image. If you have Alamy, Shutterstock, or your custom watermarked images, please add &lt;code&gt;mask.png&lt;/code&gt; inside &lt;code&gt;utils/&amp;lt;watermark-type&amp;gt;/&amp;lt;image-type&amp;gt;&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="o"&gt;%%&lt;/span&gt;&lt;span class="n"&gt;shell&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;$(conda shell.bash hook)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;conda&lt;/span&gt; &lt;span class="n"&gt;activate&lt;/span&gt; &lt;span class="n"&gt;myenv&lt;/span&gt;

&lt;span class="n"&gt;cd&lt;/span&gt; &lt;span class="n"&gt;watermark&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;removal&lt;/span&gt;
&lt;span class="n"&gt;python&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;checkpoint_dir&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;watermark_type&lt;/span&gt; &lt;span class="n"&gt;istock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Please give a star to &lt;a href="https://github.com/jivaniyash/watermark-removal" rel="noopener noreferrer"&gt;Github Repository&lt;/a&gt; which is forked from &lt;a href="https://github.com/zuruoke/watermark-removal" rel="noopener noreferrer"&gt;zuruoke/watermark-removal&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To configure TensorFlow=1.15, &lt;a href="https://github.com/googlecolab/colabtools/issues/3266#issuecomment-1348660900" rel="noopener noreferrer"&gt;setup conda env inside colab&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>computervision</category>
      <category>tensorflow</category>
      <category>python</category>
    </item>
    <item>
      <title>Interpreting Benchmarks and Evaluations in LLMs</title>
      <dc:creator>Yash Jivani</dc:creator>
      <pubDate>Tue, 25 Jun 2024 19:38:54 +0000</pubDate>
      <link>https://forem.com/jivaniyash/interpreting-benchmarks-and-evaluations-in-llms-312h</link>
      <guid>https://forem.com/jivaniyash/interpreting-benchmarks-and-evaluations-in-llms-312h</guid>
      <description>&lt;p&gt;Welcome to the era of Large Language Models (LLMs). If you've heard terms like "benchmarks" or "evaluations" and wondered what they mean &amp;amp; how to interpret them in the context of LLMs, you're in the right place. Let's break down these concepts to understand them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benchmarks
&lt;/h2&gt;

&lt;p&gt;Benchmarks refer to standardized tests or tasks in the form of datasets used to evaluate and compare the performance of different models. These benchmarks often include various language understanding and generation tasks, such as text completion, question answering, and summarization. Benchmarks provide a measure of how well an LLM performs compared to others. Some of the benchmarks used to evaluate LLMs are - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;General Language Understanding Evaluation (GLUE)&lt;/strong&gt; benchmark is a collection of 9 natural language understanding tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MMLU (Massive Multitask Language Understanding)&lt;/strong&gt; is a benchmark to measure knowledge acquired during pretraining. It covers 57 subjects across STEM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HumanEval&lt;/strong&gt; focuses on whether the LLM's generated code works as intended
Detailed information can be found in [2] &amp;amp; [3].&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Evaluations
&lt;/h2&gt;

&lt;p&gt;Evaluation refers to measuring and assessing a model's performance and effectiveness in how accurately the model can predict or generate the next word in a sentence, understand context, summarize data, and respond to queries. Evaluation is crucial because it helps determine the model's strengths and weaknesses, and provides insights into areas of improvement. There are 2 different ways to compute metrics scores&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Statistical Scorer&lt;br&gt;
These are purely number-based scorers - i.e. they don't consider semantics into account. Some of these are - &lt;br&gt;
a. &lt;strong&gt;BLEU (BiLingual Evaluation Understudy)&lt;/strong&gt; evaluates the output of LLM application against annotated ground truths by calculation precision for each matching n-gram between actual &amp;amp; predicted outputs.&lt;br&gt;
b. &lt;strong&gt;ROUGE (Recall-Oriented Understudy for Gisting Evaluation)&lt;/strong&gt; is primarily used for evaluating text summaries from NLP models and calculates recall by comparing the overlap of n-grams between LLM outputs and expected outputs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Model-Based Scorer&lt;br&gt;
These are NLP-based scorer that takes semantics into account. Some of these are - &lt;br&gt;
a. &lt;strong&gt;BLEURT(Bilingual evaluation understudy with Representations from Transformers)&lt;/strong&gt;, often used for machine translation, uses pre-trained models like BERT to score LLM outputs on some expected outputs&lt;br&gt;
b. &lt;strong&gt;NLI(Natural Language Inference)&lt;/strong&gt; uses the NLP classification model to classify whether an LLM output is logically consistent (entailment), contradictory, or unrelated (neutral) with respect to a given reference text.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Detailed information can be found in [4].&lt;/p&gt;




&lt;p&gt;After undergoing the benchmark’s evaluation, models are usually awarded a score from 0 to 100. These are the numbers you usually see when companies publish along with their LLM model to compare other models evaluated on the benchmark.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.turing.com/resources/understanding-llm-evaluation-and-benchmarks" rel="noopener noreferrer"&gt;Turing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://paperswithcode.com/datasets" rel="noopener noreferrer"&gt;Papers with Code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://humanloop.com/blog/llm-benchmarks" rel="noopener noreferrer"&gt;HumanLoop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.confident-ai.com/blog/llm-evaluation-metrics-everything-you-need-for-llm-evaluation" rel="noopener noreferrer"&gt;Confident-AI&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>beginners</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
