<?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 Abhishek_Anilkumar on Medium]]></title>
        <description><![CDATA[Stories by Abhishek_Anilkumar on Medium]]></description>
        <link>https://medium.com/@abhishek18.anilkumar?source=rss-74a512f550c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_H6vkcXnxbW_1BZ0</url>
            <title>Stories by Abhishek_Anilkumar on Medium</title>
            <link>https://medium.com/@abhishek18.anilkumar?source=rss-74a512f550c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:29:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishek18.anilkumar/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[Google Colab Just got Smarter :-)]]></title>
            <link>https://medium.com/@abhishek18.anilkumar/google-colab-just-got-smarter-818ec69045ad?source=rss-74a512f550c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/818ec69045ad</guid>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Abhishek_Anilkumar]]></dc:creator>
            <pubDate>Thu, 01 May 2025 15:09:21 GMT</pubDate>
            <atom:updated>2025-05-01T15:09:21.523Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google Colab Just got Smarter :-)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlPwdYm5Vra7c8ruuxDC4w.jpeg" /><figcaption>Image has sourced from google.</figcaption></figure><p>On <strong>March 3rd</strong>, Google officially launched its <strong>Data Science Agent</strong> to the majority of <strong>Colab</strong> users at no cost. While this isn’t entirely new — having been initially announced in <strong>December of last year</strong> — it is now fully integrated into <strong>Google Colab</strong> and broadly available.</p><p>In this article, I’ll delve into these questions using practical, real-world examples.</p><p>How access the Smarter Version of Collab.</p><p>Getting started with Google’s <strong>Data Science Agent</strong> in Colab is simple and user-friendly:</p><ol><li><strong>Open a new notebook</strong> in <a href="https://colab.research.google.com/drive/">Google Colab</a> — all you need is a Google Account, and access remains completely free.</li><li>Click on <strong>“Analyze files with Gemini”</strong> — this will launch the Gemini chat interface on the right-hand side of your notebook.</li><li><strong>Upload your dataset</strong> and describe your analysis objective in plain language through the chat window. Based on your input, the agent will automatically create a sequence of analytical tasks.</li><li>Click <strong>“Execute Plan”</strong>, and Gemini will begin generating and populating your Jupyter Notebook with code tailored to your goal.</li></ol><p>For this experiment, I used the <a href="https://www.kaggle.com/datasets/nikhil7280/student-performance-multiple-linear-regression/data"><strong>Student Performance</strong></a> dataset designed for a <strong>Multiple Linear Regression</strong> analysis. The dataset includes the following <strong>five features</strong>:</p><ul><li><strong>Hours Studied</strong>: Total number of hours each student dedicated to studying.</li><li><strong>Previous Scores</strong>: Scores achieved by students in prior examinations.</li><li><strong>Extracurricular Activities</strong>: Indicates student participation in extracurricular activities (Yes/No).</li><li><strong>Sleep Hours</strong>: Average number of sleep hours per day.</li><li><strong>Sample Question Papers Practiced</strong>: Number of sample papers each student practiced before the test.</li></ul><p>Once you open <strong>Google Colab</strong>, you’ll be greeted by <strong>Gemini AI</strong>, which is ready and waiting to assist you with your prompts right from the start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKpRaxOD4E71aHRH8wLhcw.png" /><figcaption>Google Colab Home Screen</figcaption></figure><p>Once the dataset is uploaded via the <strong>Gemini interface on the right side</strong> of the Colab notebook, we can begin by entering a few prompts describing our analysis goals. After that, clicking <strong>“Execute Plan”</strong> initiates the automated generation of a tailored Jupyter Notebook with the required analysis steps.</p><p>After giving the prompt (I have the dataset about Student performance and its a multi linear regression problem. can you give me the multi linear regression problem code with all step starting from reading the code, EDA, null filling, normalization and model training and testing) we are getting the following output from Gemini Console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WS3pYYCokJEYW2LEXW7A7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8DKqIt2sNddkp5p7NZ4ueQ.png" /></figure><p>After running my experiment, here are the highlights I’ve observed from the Data Science Agent’s performance:</p><p><strong>Customizable execution plan:<br></strong>Based on my prompt — <em>“I have a dataset about student performance and it’s a multiple linear regression problem. Can you provide the complete code for this, including data loading, EDA, handling missing values, normalization, model training, and testing?”</em> — the Gemini AI agent followed a standard end-to-end machine learning workflow. The generated plan included:</p><ul><li><strong>Data Loading</strong></li><li><strong>Data Exploration (EDA)</strong></li><li><strong>Data Cleaning (including handling missing values)</strong></li><li><strong>Data Preparation (feature selection and normalization)</strong></li><li><strong>Data Splitting</strong> (into training and testing sets)</li><li><strong>Model Training</strong> using a multiple linear regression approach</li><li><strong>Model Evaluation</strong> to assess performance metrics</li><li><strong>Task Completion Summary</strong></li></ul><p>After completing the code by the Gemini AI, i have executed the code. The code was executed without any hiccups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwQyM3bZL9EXKLu0fig54w.png" /><figcaption>Code Execution Output</figcaption></figure><p><strong>What it Cannot do:</strong></p><ul><li><strong>Limited notebook updates</strong>: One major shortcoming is that the Agent does not modify the Jupyter Notebook based on follow-up prompts. While the Jupyter Notebook environment is great for iterative development, in my experience, after running the initial code, I noticed that the Feature Importance charts lacked feature labels. I requested the Agent to add them, assuming it would update the code directly or at least insert a new cell with the refined code. However, the Agent only provided the updated code in the chat window, leaving the task of updating the notebook to me. Similarly, when I asked for a new section with recommendations to lower insurance premiums, the Agent responded with its suggestions in the chat rather than adding them to the notebook as a markdown cell. While copying and pasting isn’t a huge issue, it’s disappointing that further interactions remain confined to the chat window, just like with ChatGPT.</li><li><strong>Choice of approach</strong>: Although the Agent follows a reasonable workflow for regression problems — cleaning data, handling missing values, performing feature engineering, and training multiple models (Linear Regression, Random Forest, and Gradient Boosting Trees) — not all of its choices are optimal. For instance, it used mean imputation for missing values, which might not be ideal for highly skewed data and could affect the relationships between variables. Additionally, feature engineering is often an iterative process, where multiple ideas are tested to see their impact on the model’s performance. While the Agent sets up a solid foundation, there’s still a need for human intervention to refine and improve the analysis.</li><li><strong>Google Colab-specific issues</strong>: When using an AI agent in Google Colab, one demerit I’ve noticed is that it may not fully leverage Colab’s interactive capabilities. For instance, the AI may generate code that works well in isolation, but it doesn’t always optimize for the collaborative and iterative nature of Colab, where quick testing and visualization can be crucial. Moreover, integration with external datasets or services may be cumbersome at times, as the agent might not be fully aware of the resources available in your specific environment. It might not always auto-detect paths or manage dependencies effectively, requiring manual intervention.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=818ec69045ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is accuracy the sole metric that should be prioritized for Large Language Models?]]></title>
            <link>https://medium.com/@abhishek18.anilkumar/is-accuracy-the-sole-metric-that-should-be-prioritized-for-large-language-models-b01d34ed45e4?source=rss-74a512f550c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b01d34ed45e4</guid>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[research]]></category>
            <category><![CDATA[llama-2]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Abhishek_Anilkumar]]></dc:creator>
            <pubDate>Thu, 18 Jul 2024 16:31:34 GMT</pubDate>
            <atom:updated>2024-07-18T16:31:34.557Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpanoKK0olFZxfLMby6kaA.jpeg" /><figcaption>Image Credits : <a href="https://webz.io/blog/machine-learning/large-language-models-what-your-data-must-include/">https://webz.io/blog/machine-learning/large-language-models-what-your-data-must-include/</a></figcaption></figure><p>When Large Language Models (LLMs) undergo compression techniques like quantization, evaluating their efficacy typically revolves around measuring the model’s accuracy across a spectrum of benchmarks. This approach serves as a primary method to validate the effectiveness and feasibility of compression techniques in maintaining or improving model performance while reducing computational complexity and memory footprint.<br>According to a research paper by Microsoft researchers titled “Accuracy is Not All You Need,” besides accuracy, it is crucial to consider additional metrics when comparing the performance of quantized and baseline LLM models. The authors propsoed two performance metrics KL-Divergence and % flips. <br>In this article i’ll be beifily explaining all the metric the authors have used in this research.</p><ul><li>Accuracy : Accuracy serves as a fundamental metric assessing the model’s performance by determining the percentage of correct responses, especially in question-answering scenarios. In multiple-choice question-answering (MCQ) tasks like MMLU, the model must select and match a single token (A/B/C/D) to the correct answer.</li><li>Perplexity : Perplexity is a metric that evaluates the overall language modeling capability of an LLM. It is defined as the exponent of the average negative log-likelihood calculated across a specific dataset.</li><li>Flip : Flips, as a distance metric, quantifies the percentage of answers that change from correct to incorrect or incorrect to correct between a baseline and quantized model across tasks with identifiable correct and incorrect answers.</li><li>KL Diveregence : KL-divergence, as a distance metric, is computed across a multiple-choice dataset by comparing probability distributions of tokens between a baseline and quantized model. For each option in the dataset, represented by Pb(i, j) and Pq(i, j) for the baseline and quantized models respectively, KL-divergence is calculated as the mean of divergences across all tokens and all answer options in the dataset.</li></ul><p>Here are the details summarized for the LLMs, tasks, and quantization techniques used in the study:<br><strong>Model:</strong> Primarily Llama2 chat (Touvron et al., 2023) and Yi chat (01.AI et al., 2024) models, along with their pretrained non-chat versions.</p><p><strong>Quantization Techniques:</strong></p><ul><li>LLM.int8() (Dettmers et al., 2022) implemented in Bitsandbytes (bnb, 2024) with 8-bit (BnB W8A8) and 4-bit (BnB W4A4) versions.</li><li>GPTQ (Frantar et al., 2023) and AWQ (Lin et al., 2024) with a group size of 128.</li><li>Smoothquant (Xiao et al., 2024) with per-token, per-channel quantization using α = 0.5 (SQ W8A8).</li><li>TensorRT (trt, 2024) for SmoothQuant, while other schemes utilized HuggingFace Transformers.</li></ul><p><strong>Tasks Evaluated:</strong></p><ul><li>MMLU</li><li>ARC</li><li>PIQA</li><li>Winogrande</li><li>Hellaswag</li><li>Lambada</li><li>GSM8k</li><li>TriviaQA</li><li>MT-Bench</li></ul><p>Further details related to this research is available as a preprint release on <a href="https://arxiv.org/pdf/2407.09141">https://arxiv.org/pdf/2407.09141</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b01d34ed45e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Play store, App Store, Microsoft Store Now OpenAI has launched GPT store!]]></title>
            <link>https://medium.com/@abhishek18.anilkumar/play-store-app-store-microsoft-store-now-openai-has-launched-gpt-store-f0ee0d648a87?source=rss-74a512f550c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0ee0d648a87</guid>
            <category><![CDATA[bard-ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[gpt]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Abhishek_Anilkumar]]></dc:creator>
            <pubDate>Sun, 14 Jan 2024 12:23:07 GMT</pubDate>
            <atom:updated>2024-01-14T13:16:09.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5OJZ0ZFZ6smb7Ylz9a-98Q.png" /><figcaption>DALL-E Generated image : barabrians with wings.</figcaption></figure><p>OpenAI recently launched the GPT Store, an innovative platform catering to users on premium plans. This platform enables users to craft, market, and distribute personalized AI models derived from OpenAI’s extensive language models (LLMs). The introduction of the GPT Store follows the successful rollout of the GPT Builder program in November, with an impressive milestone of over 3 million custom GPTs crafted by users. This initiative marks a significant stride in empowering users to not only leverage but also commercialize their tailored AI solutions.</p><h4>How to Access the GPT Store?</h4><p>To access the GPT Store, individuals are required to subscribe to one of OpenAI’s premium ChatGPT plans, namely ChatGPT Plus, ChatGPT Enterprise, or the recently introduced ChatGPT Team.</p><h4>Revenue Sharing Program</h4><p>In addition, there is noteworthy information for creators. OpenAI intends to launch a revenue-sharing program with GPT creators, commencing in the first quarter of the year. This signifies that users have the opportunity not only to customize their AI models but also to potentially earn income from their creations.</p><h4><strong>What is ChatGPT Team?</strong></h4><p>OpenAI has unveiled a new subscription plan named ChatGPT Team, available at a rate of $25 per month per user for annual billing or $30 per month for monthly billing. Tailored for teams of up to 150 individuals, this plan encompasses advanced features akin to those found in ChatGPT Enterprise. Subscribers benefit from access to GPT-4 and DALL-E 3, coupled with the capability to fashion custom GPTs to suit their specific requirements.</p><p><strong>GPT Store at a glance!</strong></p><p>For ChatGPT Plus, Team, or Enterprise users, an initial glimpse into the GPT Store can be achieved by navigating to the sidebar and selecting the “Explore GPTs” option.</p><p>Link for GPT Store : <a href="https://chat.openai.com/gpts">https://chat.openai.com/gpts</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSu_2TqWRFQCAH9HkOnjMg.png" /><figcaption>GPT Store Landing page</figcaption></figure><p>Users have the capability to search for any public GPT within the GPT Store, based on various filters such as writing, productivity, programming etc.</p><p>This article has been written with the help of ChatGPT and Bard. This is my third Article. Kindly let me know in case of any improvement is required.</p><p><strong>Thank You</strong></p><p><strong>:-)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0ee0d648a87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crafting a comprehensive Language Model (LLM) and a robust Large Image Model application with the…]]></title>
            <link>https://medium.com/@abhishek18.anilkumar/crafting-a-comprehensive-language-model-llm-and-a-robust-large-image-model-application-with-the-ee6e129a075b?source=rss-74a512f550c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee6e129a075b</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[gemini]]></category>
            <dc:creator><![CDATA[Abhishek_Anilkumar]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 16:08:53 GMT</pubDate>
            <atom:updated>2023-12-25T16:41:05.155Z</atom:updated>
            <content:encoded><![CDATA[<h3>Crafting a comprehensive Language Model (LLM) and a robust Large Image Model application with the prowess of Gemini Pro, elevating the essence of innovation to new heights.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*X4huikJy5TyLgoWy.jpg" /></figure><p>In this article we will see how to use Gemini Pro API to create a LLM model is our local system. Before creating the application, following prerequiste libraries are required in the local machine.</p><ul><li>streamlit : Streamlit is a dynamic and intuitive Python library that empowers users to create interactive and visually appealing web applications with remarkable ease.</li><li>google-generativeai : For accessing the google gen ai APIs.</li><li>python-dotenv : python-dotenv is a Python library that allows you to manage configuration settings in your Python projects by using a separate file for environment variables. This is often done using a file named ‘.env’.</li></ul><p>After installing the necessary libraries, the next step involves generating an API key for utilizing the Gemini API, as elucidated in a separate article available at this link: <a href="https://medium.com/@abhishek18.anilkumar/introducing-gemini-pro-your-brand-new-language-model-in-town-a-guide-to-configuration-and-usage-28356a43b472">Gemini API Key Generation Guide</a>. Subsequently, save the generated API key by creating a .env file within the directory on your local machine.</p><h3>For Text Response:</h3><p>Next file we are going to create the app.py, which is used for text data.</p><ol><li>The first step is to load all the library to create the model. All the library that has mentioned in the starting of the article is declared here.</li></ol><pre># Importing the necessary modules for configuration and execution<br>from dotenv import load_dotenv  # Loading environment variables from a .env file<br>load_dotenv()  # Executing the process to load all environment variables<br><br>import streamlit as st  # Importing the Streamlit library for creating interactive web applications<br>import os  # Importing the os module for interacting with the operating system<br><br># Importing the Google Generative AI module for specific functionalities<br>import google.generativeai as genai  # Note: Please ensure the correct module path based on your project structure</pre><p>2. Next is to load the API for the gemini AI.</p><pre>genai.configure(api_key=os.getenv(&quot;GOOGLE_API_KEY&quot;))</pre><p>3. Develop a function designed to generate content tailored to the specific prompt provided for consumption by the application programming interface (API). Since we are using text based prompt, the API used here is gemini-pro.</p><pre>#function to load gemini model and get responses<br>model=genai.GenerativeModel(&#39;gemini-pro&#39;)   #for text text we are using gemini pro<br>def get_gemini_res(prompt):                 #function which return answer for the prompt we are giving.<br>    response=model.generate_content(prompt)<br>    return response.text</pre><p>4. Configuring the streamlit app.</p><pre># Initialize our Streamlit app<br>st.set_page_config(page_title=&quot;Gemini Demo&quot;)  # Set the page title for the Streamlit app<br>st.header(&quot;Gemini Pro Text Prompt Application&quot;)  # Display a header for the Streamlit app<br>input_text = st.text_input(&quot;Input: &quot;, key=&quot;input&quot;)  # Create a text input widget for user input, with a specified key<br>submit_button = st.button(&quot;Gemini Pro here to help you!&quot;)  # Create a button labeled &quot;Gemini Pro here to help you!&quot;</pre><p>5. Code to printing the response from the API.</p><pre>if submit_button:<br>    # Retrieve the Gemini response based on the user input<br>    response = get_gemini_res(input_text)<br><br>    # Display the response as a subheader and write it to the Streamlit app<br>    st.subheader(&quot;Certainly! The Response is&quot;)<br>    st.write(response)</pre><p>6. Save this file as app.py.</p><p>7. Open Anaconda command prompt, got to the path where app.py is saved and run the command.</p><pre>streamlit run app.py</pre><p>Once the command has been executed, streamlit app will open up in the browser, as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DjGVEl6S0WIbKx6bpBfgMA.png" /><figcaption>streamlit browser window</figcaption></figure><p>8. Give a prompt and click on ‘Gemini Pro here to help you’ and we will get to see the response of our prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZNFf9m58L4trjNdhoAjiUg.png" /><figcaption>Gemini Pro response page.</figcaption></figure><h3>For Text-Image Response:</h3><p>Next file we are going to create the vision.py, which is used for image and text data.</p><ol><li>The first step is to load all the library to create the model. All the library that has mentioned in the starting of the article is declared here.</li></ol><pre># Importing the necessary modules for configuration and execution<br>from dotenv import load_dotenv  # Loading environment variables from a .env file<br>load_dotenv()  # Executing the process to load all environment variables<br><br>import streamlit as st  # Importing the Streamlit library for creating interactive web applications<br>import os  # Importing the os module for interacting with the operating system<br><br># Importing the Google Generative AI module for specific functionalities<br>import google.generativeai as genai  # Note: Please ensure the correct module path based on your project structure<br><br>from PIL import Image  # Importing the Image module from the Python Imaging Library (PIL)</pre><p>2. Next is to load the API for the gemini AI.</p><pre>genai.configure(api_key=os.getenv(&quot;GOOGLE_API_KEY&quot;))</pre><p>3. Develop a function designed to generate content tailored to the specific prompt provided for consumption by the application programming interface (API).SInce we are using text based prompt, the API used here is gemini-pro-vision. This API is multi-modal which is able to use both text and image as input. This logic of the below function help us to take both use case into picture.</p><pre>#function to load gemini model and get responses<br>model=genai.GenerativeModel(&#39;gemini-pro-vision&#39;)<br>def get_gemini_res(input, image):<br>    &quot;&quot;&quot;<br>    Get response from the Gemini Pro Vision model based on input and/or image.<br><br>    Parameters:<br>    - input (str): The input text prompt.<br>    - image (str or PIL.Image): The image input for the model.<br><br>    Returns:<br>    - str: The generated response text from the Gemini Pro Vision model.<br>    &quot;&quot;&quot;<br>    # Create an instance of the Gemini Pro Vision model<br>    model = genai.GenerativeModel(&#39;gemini-pro-vision&#39;)<br><br>    # Check if there is input text provided<br>    if input != &quot;&quot;:<br>        # Generate content using both input text and image<br>        response = model.generate_content([input, image])<br>    else:<br>        # Generate content using only the image<br>        response = model.generate_content(image)<br><br>    # Extract and return the generated response text<br>    return response.text</pre><p>4. Configuring the streamlit app.</p><pre># Initialize our Streamlit app<br>st.set_page_config(page_title=&quot;Gemini Demo&quot;)  # Set the page title for the Streamlit app<br>st.header(&quot;Gemini Vision Pro Image Text Prompt Application&quot;)  # Display a header for the Streamlit app<br><br># Create a text input widget for user input prompt<br>input_text = st.text_input(&quot;Input Prompt: &quot;, key=&quot;input&quot;)</pre><p>5. Since we are using image for this application, here we are asking user to upload an image.</p><pre># Allow users to upload an image<br>uploaded_file = st.file_uploader(&quot;Choose an image...&quot;, type=[&quot;jpg&quot;, &quot;jpeg&quot;, &quot;png&quot;])<br>image = &quot;&quot;<br><br># Display the uploaded image if available<br>if uploaded_file is not None:<br>    image = Image.open(uploaded_file)<br>    st.image(image, caption=&quot;Uploaded Image.&quot;, use_column_width=True)<br><br># Create a button labeled &quot;Tell me about the image&quot;<br>submit_button = st.button(&quot;Tell me about the image&quot;)<br></pre><p>6. Code to printing the response from the API.</p><pre># If the &quot;Tell me about the image&quot; button is clicked<br>if submit_button:<br>    # Get the Gemini response based on the input prompt and uploaded image<br>    response = get_gemini_response(input_text, image)<br>    <br>    # Display the response as a subheader and write it to the Streamlit app<br>    st.subheader(&quot;The Response is&quot;)<br>    st.write(response)</pre><p>7. Open Anaconda command prompt, got to the path where app.py is saved and run the command.</p><pre>streamlit run vision.py</pre><p>Once the command has been executed, streamlit app will open up in the browser, as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WdT6_MDuQAXiGu3eDc_8SA.png" /><figcaption>streamlit browser response</figcaption></figure><p>8. Give a prompt and image and click on ‘Tell me about the image’ and we will get to see the response of our prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwaJhcpXv38Zn7dBHbcPOw.png" /><figcaption>Gemini Vision pro response prompt.</figcaption></figure><p>The link to the ipynb having the complete code has been attached with this github link(<a href="https://github.com/AKA-18/Large-Language-Models/tree/main/Gemini/End%20to%20End%20LLM">https://github.com/AKA-18/Large-Language-Models/tree/main/Gemini/End%20to%20End%20LLM</a>).</p><p>This article has been written with the help of ChatGPT and Bard. This is my first Article. Kindly let me know in case of any improvement is required.</p><p><strong>Thank You</strong></p><p><strong>:-)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee6e129a075b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Gemini Pro: Your Brand-New Language Model in Town — A Guide to Configuration and Usage!]]></title>
            <link>https://medium.com/@abhishek18.anilkumar/introducing-gemini-pro-your-brand-new-language-model-in-town-a-guide-to-configuration-and-usage-28356a43b472?source=rss-74a512f550c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/28356a43b472</guid>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[google-gemini]]></category>
            <category><![CDATA[google-gemini-pro]]></category>
            <dc:creator><![CDATA[Abhishek_Anilkumar]]></dc:creator>
            <pubDate>Fri, 22 Dec 2023 12:39:19 GMT</pubDate>
            <atom:updated>2023-12-25T16:06:04.025Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introducing Gemini Pro: A Brand-New Large Language Model in Town — A Guide to Configuration and Usage!</h3><p>Hello! In this post, we will delve into the configuration and usage of Google’s latest LLM released in December 2023. Currently, the Gemini Pro API Key is available on the GoogleAI for Developers website.</p><h3><strong>What is Gemini?</strong></h3><p>Gemini is a family of multimodal large language models (LLMs) developed by Google DeepMind. Think of it as Google’s next big step in AI, succeeding LaMDA and PaLM 2. There are three versions:</p><ul><li>Gemini Ultra: The most powerful and capable, designed for tackling highly complex tasks.</li><li>Gemini Pro: The workhorse model, offering a great balance of power and efficiency for a wide range of tasks.</li><li>Gemini Nano: The lightweight version, making AI accessible even on devices like smartphones.</li></ul><h3><strong>What makes it special?</strong></h3><ul><li>Multimodality: This is Gemini’s key strength. It can understand and process different types of information, including text, code, audio, images, and even video. This means it can go beyond just text-based tasks and perform things like analyzing images, summarizing videos, or even generating music based on written prompts.</li><li>Reasoning Capabilities: Gemini isn’t just a glorified parrot repeating memorized information. It can actually reason and think critically, making it ideal for tasks like solving problems, making decisions, and answering complex questions.</li><li>Flexibility: Gemini runs efficiently on a wide range of devices, from powerful data centers to your everyday smartphone. This makes it incredibly versatile and opens up the possibilities for its applications.</li></ul><h3><strong>What can it do?</strong></h3><p>The potential applications of Gemini are vast and still being explored. Here are a few examples:</p><ul><li>Powering next-generation search engines: Imagine searching for information by simply showing Gemini an image or describing what you need.</li><li>Building smarter conversational agents: Chatbots that can truly understand and respond to your needs, whether it’s booking a flight, troubleshooting a tech issue, or having a meaningful conversation.</li><li>Boosting creativity and productivity: From generating new ideas to automating tedious tasks, Gemini can be a powerful tool for various fields like art, science, and business.</li></ul><p><strong>Gemini Pro is currently available through Google’s AI Studio and Vertex AI platforms for developers and enterprises.</strong></p><h3><strong>How to use Gemini-Pro API key for promoting?</strong></h3><p>To harness the capabilities of Gemini-Pro for optimizing prompts in applications like chat-GPT, it is essential to adhere to a systematic procedure. Commence by visiting the official pricing page at <a href="https://ai.google.dev/pricing">https://ai.google.dev/pricing</a> to initiate the generation of your API key.</p><p>Navigate to the pricing tab to explore the free version of Gemini Pro. Presently, the free version supports a maximum of 60 queries per minute. The following figure provides a detailed explanation of the features and limitations of the Gemini Pro free version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ad0ny8K2Kv0OiMJZDOOIaQ.png" /><figcaption>Gemini Pro comparsion of free and paid version.</figcaption></figure><p>Subsequently, please click on “Get API key in Google AI Studio” to proceed with the generation of the API key. It is crucial to prioritize the security of your API key by keeping it confidential and refraining from sharing it with anyone, as it holds the potential for misuse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPQgSq39KSZRXz98J0unwA.png" /><figcaption>AI Studio API creation tab.</figcaption></figure><p>Within the AI Studio lab, you have the capability to both create new prompts and generate API keys. However, for the purpose of this blog, our focus will be strictly on the creation of API keys. Let’s narrow our scope accordingly.</p><p>Select “Generate API key,” then proceed to copy the generated API key. For security purposes, it is recommended to paste the API key on a secure platform, such as a sticky note, and store it in a safe location. This precautionary measure helps safeguard the API key from unauthorized access and potential misuse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-670ctvlpnynANH2O8DMww.png" /><figcaption>API creation</figcaption></figure><p>Now that we have obtained the API keys, we are prepared to harness the capabilities of Gemini Pro for prompt engineering. The Gemini Pro API utilized in this tutorial currently accommodates both text-based and image-based prompts. The upcoming sections will provide a comprehensive guide on utilizing the API keys for effective prompt engineering.</p><p>Open Google Colaboratory for using API keys for prompt engineering.</p><ul><li>The first step is to install the Python SDK. The Python SDK for the Gemini API, is contained in the <a href="https://pypi.org/project/google-generativeai/">google-generativeai</a> package. Install the dependency using pip.</li></ul><pre>!pip install -q -U google-generativeai</pre><ul><li>Import the necessary packages.</li></ul><pre>import pathlib<br>import textwrap<br><br>import google.generativeai as genai<br><br># Used to securely store your API key<br>from google.colab import userdata<br><br>from IPython.display import display<br>from IPython.display import Markdown<br><br><br>def to_markdown(text):<br>  text = text.replace(&#39;•&#39;, &#39;  *&#39;)<br>  return Markdown(textwrap.indent(text, &#39;&gt; &#39;, predicate=lambda _: True))<br></pre><ul><li>Setup your API key:(here you have to put the API key genearted previously)</li></ul><pre>import os<br>os.environ[&#39;GOOGLE_API_KEY&#39;] = &#39;your api key&#39;<br>genai.configure(api_key=&#39;your api key&#39;)</pre><ul><li>Inorder to know which all Gemini models are available in the API we are use the following command.</li></ul><pre>for m in genai.list_models():<br>  if &#39;generateContent&#39; in m.supported_generation_methods:<br>    print(m.name)</pre><p>At the time of writing the blog, two model are available in the gemini.</p><ol><li>gemini-pro : optimized for text-only prompts.</li><li>gemini-pro-vision : optimized for text-and-images prompts.</li></ol><p>This marks the end of API configuration. The following sections discuss about the use of gemini model for text and text-image prompts</p><p><strong>For text-only prompts, use the gemini-pro model:</strong></p><p>Following steps explain how to use gemini-pro model.</p><ol><li>Configure the gemini-pro model.</li></ol><pre>model = genai.GenerativeModel(&#39;gemini-pro&#39;)</pre><p>The generate_content method can handle a wide variety of use cases, including multi-turn chat and multimodal input, depending on what the underlying model supports. The available models only support text and images as input, and text as output.</p><p><strong>2. </strong>In the simplest case, you can pass a prompt string to the GenerativeModel.generate_content method:</p><pre>%%time<br>response = model.generate_content(&quot;Give you question/prompt here?&quot;)</pre><p><strong>3.</strong> In simple cases, the response.text accessor is all you need. To display formatted Markdown text, use the to_markdown function:</p><pre>to_markdown(response.text)</pre><p>If the API failed to return a result, use GenerateContentRespose.prompt_feedback to see if it was blocked due to saftey concerns regarding the prompt.</p><pre>response.prompt_feedback</pre><p>on execution of the above code we will get the responce as follows:</p><pre>safety_ratings {<br>  category: HARM_CATEGORY_SEXUALLY_EXPLICIT<br>  probability: NEGLIGIBLE<br>}<br>safety_ratings {<br>  category: HARM_CATEGORY_HATE_SPEECH<br>  probability: NEGLIGIBLE<br>}<br>safety_ratings {<br>  category: HARM_CATEGORY_HARASSMENT<br>  probability: NEGLIGIBLE<br>}<br>safety_ratings {<br>  category: HARM_CATEGORY_DANGEROUS_CONTENT<br>  probability: NEGLIGIBLE<br>}</pre><p>Based on the probability values, the content generation by the API is effected. Lesser the proabaility, highly the content will be gererated.</p><p><strong>4. </strong>Gemini can generate multiple possible responses for a single prompt. These possible responses are called candidates, and you can review them to select the most suitable one as the response.</p><p>View the response candidates with GenerateContentResponse.candidates.</p><pre>response.candidates</pre><p><strong>5. </strong>By default, the model returns a response after completing the entire generation process. You can also stream the response as it is being generated, and the model will return chunks of the response as soon as they are generated.</p><p>To stream responses, use GenerativeModel.generate_content(…, stream=True).</p><pre>%%time<br>response = model.generate_content(&quot;What is a LLM?&quot;, stream=True)</pre><pre>for chunk in response:<br>  print(chunk.text)<br>  print(&quot;_&quot;*80)</pre><p><strong>For text-and-images prompts., use the gemini-pro-vision model:</strong></p><p>Following steps explain how to use gemini-pro-vision model.</p><p>Gemini provides a multimodal model (gemini-pro-vision) that accepts both text and images and inputs. The GenerativeModel.generate_content API is designed to handle multimodal prompts and returns a text output.</p><ol><li>Get the image.</li></ol><pre>!curl -o image.jpg https://t0.gstatic.com/licensed-image?q=tbn:ANd9GcQ_Kevbk21QBRy-PgB4kQpS79brbmmEG7m3VOTShAn4PecDU5H5UxrJxE3Dw1JiaG17V88QIol19-3TM2wCHw</pre><p><strong>2. </strong>Load the image.</p><pre>import PIL.Image<br>img = PIL.Image.open(&#39;image.jpg&#39;)<br>img</pre><p><strong>3. </strong>Gemini-pro-vision.</p><pre>model = genai.GenerativeModel(&#39;gemini-pro-vision&#39;)</pre><p><strong>4.</strong> Inorder to get response for the image.</p><pre>response = model.generate_content(img)<br><br>to_markdown(response.text)</pre><p><strong>5.</strong> To provide both text and images in a prompt, pass a list containing the strings and images.</p><pre>response = model.generate_content([&quot;Write a short, engaging blog post based on this picture. It should include a description of the meal in the photo and talk about my journey meal prepping.&quot;, img], stream=True)<br>response.resolve()</pre><pre>to_markdown(response.text)</pre><p><strong>Chat Conversations, using gemini-pro-models.</strong></p><p>Gemini enables you to have freeform conversations across multiple turns. The ChatSession class simplifies the process by managing the state of the conversation, so unlike with generate_content, you do not have to store the conversation history as a list.</p><p>1.Initialize the chat:</p><pre>model = genai.GenerativeModel(&#39;gemini-pro&#39;)<br>chat = model.start_chat(history=[])<br>chat</pre><p>Note: At the time of writing the blog, the vision model gemini-pro-vision is not optimized for multi-turn chat.</p><p><strong>2. </strong>The ChatSession.send_message method returns the same GenerateContentResponse type as GenerativeModel.generate_content. It also appends your message and the response to the chat history.</p><pre>response = chat.send_message(&quot;In one sentence, explain how a computer works to a young child.&quot;)<br>to_markdown(response.text)</pre><p><strong>3. </strong>Inorder to view the chat history, followinf command can be used</p><pre>chat.history</pre><p><strong>4. </strong>You can keep sending messages to continue the conversation. Use the stream=True argument to stream the chat.</p><pre>response = chat.send_message(&quot;Okay, how about a more detailed explanation to a high schooler?&quot;, stream=True)<br><br>for chunk in response:<br>  print(chunk.text)<br>  print(&quot;_&quot;*80)</pre><p><strong>5. </strong>glm.Content objects contain a list of glm.Part objects that each contain either a text (string) or inline_data (glm.Blob), where a blob contains binary data and a mime_type. The chat history is available as a list of glm.Content objects in ChatSession.history.</p><pre>for message in chat.history:<br>  display(to_markdown(f&#39;**{message.role}**: {message.parts[0].text}&#39;))</pre><p>The link to the ipynb having the complete code has been attached with this github link(<a href="https://github.com/AKA-18/Large-Language-Models/blob/main/Gemini/API%20Quick%20Starter/Gemini%20-%20API%20Quick%20Started.ipynb">https://github.com/AKA-18/Large-Language-Models/blob/main/Gemini/Gemini%20-%20API%20Quick%20Started.ipynb</a>). Documentation required for using gemini pro is available in the link(<a href="https://ai.google.dev/docs">https://ai.google.dev/docs</a>)</p><p>This article has been written with the help of ChatGPT and Bard. This is my first Article. Kindly let me know in case of any improvement is required.</p><p><strong>Thank You</strong></p><p><strong>:-)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28356a43b472" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>