AI APIs for Web Devs - Concrete applications
SamyMe
Posted on December 19, 2022
Have you ever wondered how you, as a web developer, can grasp the power of AI ?
But first, whatโs AI ?
Artificial Intelligence is about allowing a machine to mimic human behavior. Computers were made to do that by the power of elaborated algorithms. Now, machine and deep learning make it possible to teach computers with data what we fail to describe in an algorithmic approach. This opens the way for computers to understand and manipulating non structured data :
๐ Reading text and understanding concepts like : the topic of the text, the sentiment of the writer and the key concepts it talks about
๐ฃ๏ธ Hearing your voice, understanding the words you say and responding to you (Siri and Alexa : speech to text and text to speech)
๐ฅ Looking at an image or watching a video and understanding the big picture and the details of what it contains
But in order to achieve these objectives, you have to train large models with millions of labeled data.
Now, with AI as a Service, a lot of companies provide off-the-shelf trained models that you can access directly through an API. These companies are either the tech giants (Google, Microsoft , Amazon) or other smaller, more specialized companies, and there are hundreds of them. Some of the most known are : DeepL (translation), OpenAI (text and image analysis), AssemblyAI (speech analysis). If only there was one global API for accessing all these modelsโฆ
Usecases :
The very easy access to this intelligence through simple APIs lead to the creation of tons of use cases :
- Automatically parse unstructured documents into a structured form : If your app handles scanned documents or pdfs (example: resumes, invoices, ID documents โฆetc), you can parse them automatically to extract the data it contains and store it into a structured DB for easier manipulation.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url="https://api.edenai.run/v2/ocr/identity_parser"
data={"providers": "amazon,microsoft,mindee"}
files = {'file': open("๐ผ๏ธ path/to/your/image.png",'rb')}
response = requests.post(url, data=data, files=files, headers=headers)
result = json.loads(response.text)
print(result['amazon'])
print(result['mindee'])
- Reaching out more people by automatically translating your contents : There are tons of great text translation and language detection apis. Their performance varies depending on the language pair you need.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url ="https://api.edenai.run/v2/translation/automatic_translation"
payload={"providers": "google,deepl",
"source_language":"en",
"target_language":"fr",
"text": "This is a new test."}
response = requests.post(url, json=payload, headers=headers)
result = json.loads(response.text)
print(result['google']['text'])
print(result['deepl']['text'])
- Analyze users' feedback and concerns by (semantically) understanding textual content : text classification, extracting key concepts, and understanding the writerโs sentiment . Natural language analysis can have tons of other applications.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url ="https://api.edenai.run/v2/text/sentiment_analysis"
payload={"providers": "emvista,microsoft",
'language': "en",
'text': "this is a great test"}
response = requests.post(url, json=payload, headers=headers)
result = json.loads(response.text)
print(result['emvista']['items'])
print(result['microsoft']['items'])
- Images and videos tagging and classification : for easier storage and retrieval.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url = "https://api.edenai.run/v2/image/object_detection"
data={"providers": "clarifai,amazon"}
files = {'file': open("๐ผ๏ธ path/to/your/image.png",'rb')}
response = requests.post(url, data=data, files=files, headers=headers)
result = json.loads(response.text)
print(result['clarifai']['items'])
print(result['amazon']['items'])
- Content moderation : You can detect explicit content present in an image or a video, detect racist messages or insults in a given text.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url=" https://api.edenai.run/v2/image/explicit_content"
data={"providers": "picpurify,microsoft"}
files = {'file': open("๐ผ๏ธ path/to/your/image.png",'rb')}
response = requests.post(url, data=data, files=files, headers=headers)
result = json.loads(response.text)
print(result['picpurify']['items'])
print(result['microsoft']['items'])
- Data anonymization : You can remove Personally identifiable information (PII) information from a text before making it public. Same thing with an image by blurring faces and license plates for example.
import json
import requests
headers = {"Authorization": "Bearer ๐ Your_API_Key"}
url ="https://api.edenai.run/v2/text/anonymization"
payload={"providers": "openai",
"language": "en", "text": "My name is Jeremy and this is a test"}
response = requests.post(url, json=payload, headers=headers)
result = json.loads(response.text)
print(result['openai']['result'])
- Work with audio content : You can easily transform an audio or a microphone input to a text and analyze it's content. The inverse would be text to speech which gives your app a voice to interact in new ways with your users.
Conclusion :
As said earlier, there are tons of companies producing new APIs each day. You can find a great variety of performances at different prices. So, at Eden AI, we want to give access to all the power of AI through one standardized API. One interface for you not to bother about how to access intelligence, and only focus on inventing great apps out of it !
Posted on December 19, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.