avatarHaider Imtiaz

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

11455

Abstract

images.</p><p id="2b4c"><a href="https://cloud.google.com/vision"><b><i>Get your API here</i></b></a></p><div id="72d1"><pre><span class="hljs-meta"># AI OCR</span> <span class="hljs-meta"># pip install google-cloud-vision</span></pre></div><div id="36dc"><pre><span class="hljs-title">from</span> google.cloud <span class="hljs-keyword">import</span> vision <span class="hljs-title">from</span> google.cloud.vision <span class="hljs-keyword">import</span> types <span class="hljs-keyword">import</span> os</pre></div><div id="d4f3"><pre># <span class="hljs-keyword">Set</span> the <span class="hljs-type">path</span> <span class="hljs-keyword">to</span> your credentials <span class="hljs-type">JSON</span> file os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "credentials.json"</pre></div><div id="8580"><pre>def <span class="hljs-built_in">OCR</span>(img_path): client = vision.<span class="hljs-built_in">ImageAnnotatorClient</span>()</pre></div><div id="3e68"><pre> <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(img_path, <span class="hljs-string">'rb'</span>) <span class="hljs-keyword">as</span> image_file: content = image_file.<span class="hljs-built_in">read</span>()</pre></div><div id="9d22"><pre> <span class="hljs-built_in">image</span> = types.Image(<span class="hljs-built_in">content</span>=<span class="hljs-built_in">content</span>) response = client.text_detection(<span class="hljs-built_in">image</span>=<span class="hljs-built_in">image</span>)</pre></div><div id="8388"><pre> texts = response.text_annotations <span class="hljs-keyword">if</span> texts: <span class="hljs-keyword">return</span> texts[<span class="hljs-number">0</span>].description <span class="hljs-keyword">else</span>: <span class="hljs-keyword">return</span> <span class="hljs-string">"No text found in the image."</span> </pre></div><div id="790e"><pre><span class="hljs-variable"><span class="hljs-keyword">if</span></span> <span class="hljs-variable">name</span> == <span class="hljs-string">"main"</span>: <span class="hljs-variable">image_path</span> = <span class="hljs-string">"photo.jpg"</span> <span class="hljs-function"><span class="hljs-title">print</span>(<span class="hljs-title">OCR</span>(<span class="hljs-variable">image_path</span>))</span></pre></div><h1 id="5d49">👉 Final Thoughts</h1><p id="eb6f">The capabilities of AI are remarkable when it comes to automating work. I hope this article provides you with some useful information. If you found it helpful, please share it with your friends as sharing is caring! ❤️</p><p id="1ace" type="7">Happy Python Coding</p><p id="e727"><b><i>You can support me and others by becoming a Member of Medium Thanks! 👇</i></b></p><div id="74de" class="link-block"> <a href="https://codedev101.medium.com/membership"> <div> <div> <h2>Join Medium with my referral link — Haider Imtiaz</h2> <div><h3>As a Medium member, a portion of your membership fee goes to writers you read, and you get full access to every story…</h3></div> <div><p>codedev101.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*nXT5pzhQV3qgGMhs)"></div> </div> </div> </a> </div><p id="bbf5"><b><i>Never stop learning, Here is your daily dose of my top programming articles below, hope you like them also.</i></b></p><div id="2453" class="link-block"> <a href="https://python.plainenglish.io/10-python-automation-scripts-for-daily-problems-68991d28f490"> <div> <div> <h2>10 Python Automation Scripts for Daily Problems</h2> <div><h3>A handy script for automating your daily tasks.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*rEQdfFJwJIROd8t10-RJEQ.jpeg)"></div> </div> </div> </a> </div><div id="e7e8" class="link-block"> <a href="https://python.plainenglish.io/10-killer-apis-for-your-next-python-project-f4299126232a"> <div> <div> <h2>10 Killer APIs for Your Next Python Project</h2> <div><h3>A collection of useful public APIs you can use in your Python project</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*2SOLY9rCZqlez9kB-CY3Fg.jpeg)"></div> </div> </div> </a> </div><div id="4d7a" class="link-block"> <a href="https://python.plainenglish.io/10-python-automation-scripts-for-your-everyday-job-8ac56e1b4f32"> <div> <div> <h2>10 Python Automation Scripts for Your Everyday Job</h2> <div><h3>A handy list of python scripts for automating your daily life jobs</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*2WbWZgGoh4Mo2aJldK_MUQ.jpeg)"></div> </div> </div> </a> </div><div id="1643" class="link-block"> <a href="https://python.plainenglish.io/10-python-automation-scripts-for-your-daily-problems-aefb502969e2"> <div> <div> <h2>10 Python Automation Scripts for Your Daily Problems</h2> <div><h3>A handful of scripts for automating your daily-life tasks</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*9zZBu69u0BxNfv92yjYvhg.jpeg)"></div> </div> </div> </a> </div><div id="fb03" class="link-block"> <a href="https://python.plainenglish.io/10-python-scripts-to-automate-your-daily-stuff-e52a3d47fedf"> <div> <div> <h2>10 Python Scripts to Automate Your Daily Stuff</h2> <div><h3>Handy Scripts collection that can automate your Task and save your Time</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*2yUHpo_vgPyeORzhFEU7Bg.jpeg)"></div> </div> </div> </a> </div><div id="428d" class="link-block"> <a href="https://python.plainenglish.io/9-killer-python-automation-scripts-for-daily-problems-c1715ed42ed5"> <div> <div> <h2>9 Killer Python Automation Scripts for Daily Problems</h2> <div><h3>Killer Collection of ready-made Python Automation Scripts for Daily Problems</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*1nkZkZT0Zb6_kl_2RddOzw.jpeg)"></div> </div> </div> </a> </div><div id="397c" class="link-block"> <a href="https://python.plainenglish.io/10-automation-scripts-for-your-daily-python-projects-892a82be3f75"> <div> <div> <h2>10 Automation Scripts for Your Daily Python Projects</h2> <div><h3>Collection of scripts to automate your daily Python projects and tasks</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*CLzpCHcOXVJOIj823yPIyA.jpeg)"></div> </div> </div> </a> </div><div id="c2b0" class="link-block"> <a href="https://python.plainenglish.io/10-killer-automation-scripts-for-your-python-projects-61284d265844"> <div> <div> <h2>10 Killer Automation Scripts for Your Python Projects</h2> <div><h3>A collection of handy and killer automation scripts for your daily life Python projects</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*gD7Z65m1ELS_j8Wvq9bY0w.jpeg)"></div> </div> </div> </a> </div><div id="9722" class="link-block"> <a href="https://python.plainenglish.io/10-python-automation-scripts-for-everyday-problems-3ca0f2011282"> <div> <div> <h2>10 Python Automation Scripts for Everyday Problems</h2> <div><h3>Collection of Handy Tools for your Daily Python Projects</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*FoD7daHYoDVXFI3I6v7E5Q.jpeg)"></div> </div> </div> </a> </div><div id="2df2" class="link-block"> <a href="https://python.plainenglish.io/7-hidden-hacks-of-python-you-probably-never-used-32638811877e"> <div> <div> <h2>7 Hidden Hacks of Python You Probably Never Used</h2> <div><h3>Some Lesser-Know Python Snippets Codes</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*MZO9BzuFsRD_bs1GDyP9iA.jpeg)"></div> </div> </div> </a> </div><div id="2c2b" class="link-block"> <a href="https://python.plainenglish.io/13-python-features-most-programmers-never-used-28a6578abe00"> <div> <div> <h2>13 Python Features Most Programmers Never Used</h2> <div><h3>A list of incredible features most programmers don’t know about.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*8ixphH0JGZ_Uyf7lbwVqOg.jpeg)"></div> </div> </div> </a> </div><div id="d0e9" class="link-block"> <a href="https://python.plainenglish.io/9-cool-python-project-ideas-for-programmers-c7252c76db34"> <div> <div> <h2>9 Cool Python Project Ideas for Programmers</h2> <div><h3>A list of cool and fun Python projects that you can finish this weekend.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1

Options

*yAxSVwUnewuFmiYweAHqgw.jpeg)"></div> </div> </div> </a> </div><div id="8eec" class="link-block"> <a href="https://python.plainenglish.io/hidden-features-of-python-that-you-have-probably-never-heard-of-47af1e8abee2"> <div> <div> <h2>Python Hidden Features That You Probably Never Heard Of</h2> <div><h3>Lesser-known Python Features, Tips, and Tricks</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*NKDm9kgiBXLl2SNElFmRBg.jpeg)"></div> </div> </div> </a> </div><div id="a7de" class="link-block"> <a href="https://python.plainenglish.io/12-pro-tips-and-tricks-for-python-developers-40fa4a618c76"> <div> <div> <h2>12 Pro Tips and Tricks for Python Developers</h2> <div><h3>A list of tips and tricks to code faster and more efficiently in Python.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*cK7HAxX1EEmeQGaOEqScIA.jpeg)"></div> </div> </div> </a> </div><div id="9c2e" class="link-block"> <a href="https://python.plainenglish.io/13-python-advanced-code-snippets-for-everyday-problems-fb9874ea0b18"> <div> <div> <h2>13 Python Advanced Code Snippets for Everyday Problems</h2> <div><h3>An article on using advanced codes to make everyday Python problems easier.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*1AktzTtx2ZOH1kb8yv7Piw.jpeg)"></div> </div> </div> </a> </div><div id="db0d" class="link-block"> <a href="https://python.plainenglish.io/13-python-features-most-programmers-never-used-28a6578abe00"> <div> <div> <h2>13 Python Features Most Programmers Never Used</h2> <div><h3>A list of incredible features most programmers don’t know about.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*8ixphH0JGZ_Uyf7lbwVqOg.jpeg)"></div> </div> </div> </a> </div><div id="4074" class="link-block"> <a href="https://python.plainenglish.io/20-python-code-snippets-for-everyday-programming-problems-339346a6f996"> <div> <div> <h2>20 Python Code Snippets For Everyday Programming Problems</h2> <div><h3>Level up your programming skills with these useful Python code snippets</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*RIzNp-TiXtc4-OpvCiU8-w.jpeg)"></div> </div> </div> </a> </div><div id="2e66" class="link-block"> <a href="https://python.plainenglish.io/9-free-online-resume-builders-for-programmers-1235f014d3e1"> <div> <div> <h2>9 Free Online Resume Builders For Programmers</h2> <div><h3>Here are some free resume builders that you can use to build your resume in no time.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*TsYT3ECNYEzRVN8Owq8nlQ.png)"></div> </div> </div> </a> </div><div id="ccf1" class="link-block"> <a href="https://python.plainenglish.io/17-killer-websites-that-every-programmer-should-visit-119805fd7adc"> <div> <div> <h2>17 Killer Websites That Every Programmer should Visit</h2> <div><h3>98% of programmers and developers don’t know about these websites.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*zYBmNB6I0etS6Id2c7Xfdw.jpeg)"></div> </div> </div> </a> </div><div id="eafc" class="link-block"> <a href="https://python.plainenglish.io/build-modern-gui-in-python-using-pyqt5-framework-d3398beeb555"> <div> <div> <h2>Build Modern GUI in Python using PyQt5 Framework</h2> <div><h3>Learn to develop Modern Design GUI Program in Python using PyQt5 Framework</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*20gmIHZKX_sPY5J-6QsiJA.jpeg)"></div> </div> </div> </a> </div><div id="fc26" class="link-block"> <a href="https://python.plainenglish.io/20-extremely-useful-python-one-liners-you-must-know-6c5f3d9c875a"> <div> <div> <h2>20 Extremely Useful Python One-Liners You Must Know</h2> <div><h3>Useful Python one-liner Snippets to solve any coding problem in just one line</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*WShewTxsX-dHks6AXgCd9g.jpeg)"></div> </div> </div> </a> </div><div id="04d6" class="link-block"> <a href="https://python.plainenglish.io/9-easy-ways-to-earn-money-while-learning-python-21e1f680a6dd"> <div> <div> <h2>9 Easy Ways To Earn Money While Learning Python</h2> <div><h3>Don’t stay in bed unless you can make money in bed</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*LJN8ggsPDQKTIHcIlhWrFg.jpeg)"></div> </div> </div> </a> </div><div id="c19b" class="link-block"> <a href="https://python.plainenglish.io/22-useful-snippets-to-code-like-a-pro-in-python-1d0dcaacac69"> <div> <div> <h2>22 Useful Snippets to Code like a Pro in Python</h2> <div><h3>Get vowels, finding anagrams, sorting dictionary, n times string, byte sizing, filtering, etc. You will learn much more…</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*8lhZBBja11Pf4_K1IYCj-Q.png)"></div> </div> </div> </a> </div><div id="1f58" class="link-block"> <a href="https://python.plainenglish.io/top-python-tricks-that-will-boost-your-skills-c55e8268ca5f"> <div> <div> <h2>Top Python Tricks That Will Boost Your Skills</h2> <div><h3>Most used tricks that will boost your Python programming skills.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*3Fr1uaEJfdad-mVLbPMaIg.png)"></div> </div> </div> </a> </div><div id="01db" class="link-block"> <a href="https://python.plainenglish.io/hidden-features-of-python-that-you-have-probably-never-heard-of-47af1e8abee2"> <div> <div> <h2>Python Hidden Features That You Probably Never Heard Of</h2> <div><h3>Lesser-known Python Features, Tips, and Tricks</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*NKDm9kgiBXLl2SNElFmRBg.jpeg)"></div> </div> </div> </a> </div><div id="0197" class="link-block"> <a href="https://python.plainenglish.io/22-helpful-python-tips-and-tricks-for-beginners-43c4a8f56a1c"> <div> <div> <h2>Useful Tips and Tricks for Python Programmers</h2> <div><h3>Super Awesome Tips and Tricks for better and Pro coding in Python you should know as a Programmer.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*Ro7Fogu5keiL5jA4.png)"></div> </div> </div> </a> </div><div id="b427" class="link-block"> <a href="https://python.plainenglish.io/17-python-tips-and-tricks-to-boost-your-coding-skills-5e14054001b2"> <div> <div> <h2>17 Python Tips and Tricks to Boost your Coding Skills</h2> <div><h3>Make your life easier with these Top Python Tips and Tricks</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*Q5zOL3rCGnljaBnrwrpr0w.png)"></div> </div> </div> </a> </div><div id="a793" class="link-block"> <a href="https://python.plainenglish.io/from-zero-to-hero-in-python-in-just-10-minutes-83064ffd5aee"> <div> <div> <h2>From Zero to Hero in Python in Just 10 minutes</h2> <div><h3>Everything you need to learn to go from zero to hero in Python.</h3></div> <div><p>python.plainenglish.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*uogTxM0a-lVa__VkjFBjew.jpeg)"></div> </div> </div> </a> </div><p id="de43"><i>More content at <a href="https://plainenglish.io/"><b>PlainEnglish.io</b></a>.</i></p><p id="e1db"><i>Sign up for our <a href="http://newsletter.plainenglish.io/"><b>free weekly newsletter</b></a>. Follow us on <a href="https://twitter.com/inPlainEngHQ"><b>Twitter</b></a></i>, <a href="https://www.linkedin.com/company/inplainenglish/"><b><i>LinkedIn</i></b></a><i>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><b>YouTube</b></a>, and <a href="https://discord.gg/GtDtUAvyhW"><b>Discord</b></a><b>.</b></i></p></article></body>

5 AI APIs to Automate Your Everyday Problems

Collection of Free AI APIs to Automate your Daily Tasks and Problems

Designed by wayhomestudio on Freepik

Let's automate our manual work with today's AI technologies. Tasks such as proofreading our documents, creating art, or searching Google for answers can now be done with our favorite programming language, Python. In this article, I will share 5 AI APIs that can help automate our everyday problems. Add this article to your list and let's get started.

Artificial intelligence is the new Electricity

— Andrew Ng

👉 Image Generating AI

Want to turn your imagination into reality, then you might be interested in using an Image Generating AI API. This tool allows you to convert text into beautiful art. One such API is available at Getimg.ai, which offers up to 100 free image generations per month. Check out the API code below to give it a try.

Get your API here

# AI Image Generation
# pip install requests
import requests
import base64
def generate_image(access_token, prompt):
    url = "https://api.getimg.ai/v1/stable-diffusion/text-to-image"
    headers = {"Authorization": "Bearer {}".format(access_token)}
    data = {
            "model": "stable-diffusion-v1-5",
            "prompt": prompt,
            "negative_prompt": "Disfigured, cartoon, blurry",
            "width": 512,
            "height": 512,
            "steps": 25,
            "guidance": 7.5,
            "seed": 42,
            "scheduler": "dpmsolver++",
            "output_format": "jpeg",
        }
    response = requests.post(url, headers=headers, data=data)
    image_string = response.content
    image_bytes = base64.decodebytes(image_string)
    with open("AI_Image.jpeg", "wb") as f:
        f.write(image_bytes)
if __name__ == "__main__":
    api_key = "YOUR_API_KEY"
    prompt = "a photo of a cat dressed as a pirate"
    image_bytes = generate_image(api_key, prompt)

👉 AI Proofreader

Need an AI Proofreader for correcting your Grammer and Spelling mistakes in your Text or documents then use the below API which gives you Free API access and allows you to Fix your text with their Powerful Grammer checking AI technology.

Get your API here

# AI Proofreading
# pip install requests
import requests
def Proofreader(text):
    api_key = "YOUR_API_KEY"
    url = 'https://api.sapling.ai/api/v1/edits'
    data = {
        'key': api_key,
        'text': text,
        'session_id': 'Test Document UUID',
        'advanced_edits': {
            'advanced_edits': True,
        },
    }
    response = requests.post(url, json=data)
    resp_json = response.json()
    edits = resp_json['edits']
    print("Corrections: ", edits)
if __name__ == '__main__':
    Proofreader("I are going to the store, She don't likes pizza")

👉 AI Text_To_Speech

With Google Cloud’s text-to-speech AI technology, you can transform your text into a lifelike voice. You have the flexibility to select various options such as language, pitch, people’s voices, and much more. Best of all, Google offers a free API for your use.

Get your API here

# AI Text to Speech
# pip install google-cloud-texttospeech
# pip install playsound
import io
import os
from google.cloud import texttospeech
import playsound
# Set the path to your credentials JSON file
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "credentials.json"
def Text_to_Speech(text):
    client = texttospeech.TextToSpeechClient()
    # Set the language code and the voice name.
    language_code = "en-US"
    voice_name = "en-US-Wavenet-A"
    # Create a request to synthesize speech.
    r = texttospeech.types.SynthesizeSpeechRequest()
    r.text = text
    r.voice = texttospeech.types.VoiceSelectionParams(
        language_code=language_code, name=voice_name)
    # Set the audio encoding.
    r.audio_encoding = texttospeech.types.AudioEncoding.MP3
    # Get the response from the API.
    response = client.synthesize_speech(r)
    # Save the audio to a file.
    with io.open("audio.mp3", "wb") as f:
        f.write(response.audio_content)
    # Play the audio.
    playsound.playsound("audio.mp3", True)
if __name__ == "__main__":
    text = input("Enter the text: ")
    Text_to_Speech(text)

👉 ChatBot AI

If you are looking for a chatbot similar to chatGPT, you can use the OpenAI API. I have provided some code below that demonstrates how to use GPT 3.5 to create a personalized chatbot in Python with ease.

# ChatGPT AI
# pip install openai
import os
import openai
def ask(prompt):
  response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[
      {
        "role": "user",
        "content": prompt
      }
    ],
    temperature=1,
    max_tokens=256,
    top_p=1,
    frequency_penalty=0,
    presence_penalty=0
  )
  
  print("Ans: ", response)
if __name__ == "__main__":
    ask("Python or JavaScript?")

👉 OCR AI

Do you need to turn your scanned documents into text or extract text from images or scanned PDFs? You can use below OCR AI technology to extract text from any type of image. Below API utilizes Google Cloud Vision AI technology, which excels in detecting and analyzing text from images.

Get your API here

# AI OCR
# pip install google-cloud-vision
from google.cloud import vision
from google.cloud.vision import types
import os
# Set the path to your credentials JSON file
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "credentials.json"
def OCR(img_path):
    client = vision.ImageAnnotatorClient()
    with open(img_path, 'rb') as image_file:
        content = image_file.read()
    image = types.Image(content=content)
    response = client.text_detection(image=image)
    texts = response.text_annotations
    if texts:
        return texts[0].description
    else:
        return "No text found in the image."
if __name__ == "__main__":
    image_path = "photo.jpg"
    print(OCR(image_path))

👉 Final Thoughts

The capabilities of AI are remarkable when it comes to automating work. I hope this article provides you with some useful information. If you found it helpful, please share it with your friends as sharing is caring! ❤️

Happy Python Coding

You can support me and others by becoming a Member of Medium Thanks! 👇

Never stop learning, Here is your daily dose of my top programming articles below, hope you like them also.

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

Python
Python3
Programming
Coding
Software Development
Recommended from ReadMedium