I am using Google Cloud Vision API for scanning the business card using React-Native and the OCR part is working well. This is the my current archivement.
As you can see in the second image, the app is recognizing the text as well and I want to map it to key. Means I want to map "JOHN" to "First Name" and "SMITH" to "Last Name", +0 123 456 789 324 to "Phone Number".
'https://vision.googleapis.com/v1/images:annotate?key=' +
'YOUR_API_KEY',
{
method: 'POST',
body: JSON.stringify({
requests: [
{
image: {content: this.state.image.base64},
features: [{type: 'TEXT_DETECTION'}],
},
],
}),
},
This is my current payload. What do you think should I use for labeling the text?
Please teach me as soon as possible.
You can google "text analysis api" and find the services suitable for your needs.
If I understand this correctly, you are expecting from Cloud Vision API to classify detected text, e.g John Smith -> name, +0 12345678 -> phone, etc. If this is the case, I would suggest to use ML with a trained model to classify detected text. To do so, you can take a look on Training a model to identify names appearing in a sentence and do the same for addresses, phone numbers, etc.
Related
I am looking for an API that returns the URL of the thumbnail.
I have this API: https://www.roblox.com/asset-thumbnail/image?assetId=1970&width=768&height=432&format=png but this returns image bytes.
(the reason I asked this question here is because I can't access the developer forums)
See the docs for the Games API and the docs for the Thumbnails API.
The Thumbnail API thumbnails.roblox.com/v1/games/multiget/thumbnails?universeIds={universeID} will give you the image urls you need. However, you'll need the universeId first. So follow these steps :
1) Convert PlaceID to UniverseID
If you only know the placeID (the number from the game URL), then you can use the https://games.roblox.com/v1/games/multiget-place-details endpoint to get the universeID.
Let's use (Bee Swarm Simulator) as an example, whose placeID is 1537690962
https://games.roblox.com/v1/games/multiget-place-details?placeIds=1537690962
[
{
"placeId": 1537690962,
"name": "Bee Swarm Simulator",
"description": "Grow your own swarm of bees, collect pollen, and make honey in Bee Swarm Simulator! Meet friendly bears, complete their quests and get rewards! As your hive grows larger and larger, you can explore further up the mountain. Use your bees to defeat dangerous bugs and monsters. Look for treasures hidden around the map. Discover new types of bees, all with their own traits and personalities!\r\n\r\nJoin Bee Swarm Simulator Club for Honey, Treats and codes! https://www.roblox.com/groups/3982592\r\n\r\n\ud83e\uddf8 Bee Swarm Simulator toys are available now at Walmart Supercenters, Smyths Toys, and GameStop! Collect toy bees and hive slots to construct a real hive! There are also adorable plushies, bear action figures, and more!\r\n",
"sourceName": "Bee Swarm Simulator",
"sourceDescription": "Grow your own swarm of bees, collect pollen, and make honey in Bee Swarm Simulator! Meet friendly bears, complete their quests and get rewards! As your hive grows larger and larger, you can explore further up the mountain. Use your bees to defeat dangerous bugs and monsters. Look for treasures hidden around the map. Discover new types of bees, all with their own traits and personalities!\r\n\r\nJoin Bee Swarm Simulator Club for Honey, Treats and codes! https://www.roblox.com/groups/3982592\r\n\r\n\ud83e\uddf8 Bee Swarm Simulator toys are available now at Walmart Supercenters, Smyths Toys, and GameStop! Collect toy bees and hive slots to construct a real hive! There are also adorable plushies, bear action figures, and more!\r\n",
"url": "https://www.roblox.com/games/1537690962/Bee-Swarm-Simulator",
"builder": "Onett",
"builderId": 1912490,
"hasVerifiedBadge": false,
"isPlayable": true,
"reasonProhibited": "None",
"universeId": 601130232,
"universeRootPlaceId": 1537690962,
"price": 0,
"imageToken": "T_1537690962_3990"
}
]
And now we've got the universeID.
2) Get thumbnails
With the universeID, we can make the call to https://thumbnails.roblox.com/v1/games/multiget/thumbnails?universeIds={universeID}&size=768x432&format=Png&isCircular=false
https://thumbnails.roblox.com/v1/games/multiget/thumbnails?universeIds=601130232&size=768x432&format=Png&isCircular=false
{
"data": [
{
"universeId": 601130232,
"error": null,
"thumbnails": [
{
"targetId": 1538429222,
"state": "Completed",
"imageUrl": "https://tr.rbxcdn.com/7242c75dd5e18de97464e397164f6c68/768/432/Image/Png"
}
]
}
]
}
And now you've got the thumbnail url. Hope this helps.
I'm building a Zapier app for a platform that have dynamic fields. I have an API that returns the list of fields for one of my resource (for example) :
[
{ name: "First Name", key: "first_name", type: "String" },
{ name: "Civility", key: "civility", type: "Multiple" }
]
I build my action's inputFields based on this API :
create: {
[...],
operation: {
inputFields: [
fetchFields()
],
[...]
},
}
The API returns type that are list of values (i.e : Civility), but to get these values I have to make another API call.
For now, what I have done is in my fetchFields function, each time I encounter a type: "Multiple", I do another API call to get the possible values and set it as choices in my input field. However this is expensive and the page on Zapier takes too much time to display the fields.
I tried to use the z.dehydrate feature provided by Zapier but it doesn't work for input choices.
I can't use a dynamic dropdown here as I can't pass the key of the field possible value I'm looking for. For example, to get back the possible values for Civility, I'll need to pass the civility key to my API.
What are the options in this case?
David here, from the Zapier Platform team.
Thanks for writing in! I think what you're doing is possible, but I'm also not 100% that I understand what you're asking.
You can have multiple API calls in the function (which it sounds like you are). In the end, the function should return an array of Field objects (as descried here).
The key thing you might not be aware of is that subsequent steps have access to a partially-filled bundle.inputData, so you can have a first function that gets field options and allows a user to select something, then a second function that runs and pulls in fields based on that choice.
Otherwise, I think a function that does 2 api calls (one to fetch the field types and one to turn them into Zapier field objects) is the best bet.
If this didn't answer your question, feel free to email partners#zapier.com or join the slack org (linked at the bottom of the readme) and we'll try to solve it there.
I've got a collection of images that I'm missing information for. I'd like to be able to do a Google reverse image search to find names, keywords, links to similar images, etc. I'm aware that scraping the search results page is against the TOS, and have gotten suggestions that using the Custom Search API is the right way to go about it, but I haven't been able to find anything in the documentation detailing reverse image search. Is anyone able to point me in the right direction if this is possible with the API, or verify if it is, in fact, supported?
Much appreciated!
As for current API I have not found any mention of reverse image search functionality. not even anything except string based queries. You can look for yourself in the detail API references for custom search.
https://developers.google.com/custom-search/docs/xml_results
https://developers.google.com/custom-search/json-api/v1/reference/cse/list
So Google-custom-search doesn't provide that facility.
After looking at other APIs provided, none of them also provide this functionality. Try looking at all the different kinds of APIs supported by the Google here:
https://developers.google.com/apis-explorer/#p/
Thus the conclusion, no reverse image search thru API form Google. (this might change, I cant say anything, look at the links provided above)
There are paid apis available from some vendors.
TinEye API https://services.tineye.com/TinEyeAPI
Incandescent API http://incandescent.xyz/pricing/
Otherwise you have to ask Google to pardon you for the little TOS violation for your pet project :)
SerpApi, a third party solution, supports scraping Google reverse image. It's a paid API with a free trial.
Let's for example use this image of Danny DeVito: https://i.imgur.com/HBrB8p0.png
Example python code (available in other libraries also):
from serpapi import GoogleSearch
params = {
"engine": "google_reverse_image",
"google_domain": "google.com",
"image_url": "https://i.imgur.com/HBrB8p0.png",
"api_key": "secret_api_key"
}
search = GoogleSearch(params)
results = search.get_dict()
Example JSON response:
...
"image_results": [
{
"position": 1,
"title": "Danny DeVito - Wikipedia",
"link": "https://en.wikipedia.org/wiki/Danny_DeVito",
"displayed_link": "https://en.wikipedia.org › wiki › Danny_DeVito",
"snippet": "Daniel Michael DeVito Jr. (born November 17, 1944) is an American actor, comedian, director, producer, and screenwriter. He gained prominence for his ...",
"cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:EVb7AC9xwHYJ:https://en.wikipedia.org/wiki/Danny_DeVito+&cd=1&hl=en&ct=clnk&gl=us",
"related_pages_link": "https://www.google.com/search?q=related:https://en.wikipedia.org/wiki/Danny_DeVito&sa=X&ved=2ahUKEwi7uom3wJ_xAhWxHDQIHct6DmQQHzAAegQIBhAQ"
},
{
"position": 2,
"title": "Danny DeVito - IMDb",
"link": "https://www.imdb.com/name/nm0000362/",
"displayed_link": "https://www.imdb.com › name",
"snippet": "Danny DeVito, Actor: Matilda. Danny DeVito has amassed a formidable and versatile body of work as an actor, producer and director that spans the stage, ...",
"cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:c6r3v14HA7cJ:https://www.imdb.com/name/nm0000362/+&cd=2&hl=en&ct=clnk&gl=us"
},
{
"position": 3,
"title": "Danny DeVito - Simple English Wikipedia, the free encyclopedia",
"link": "https://simple.wikipedia.org/wiki/Danny_DeVito",
"displayed_link": "https://simple.wikipedia.org › wiki › Danny_DeVito",
"thumbnail": "https://serpapi.com/searches/60cbb000ce87f8cca8f63685/images/9db7034fa3524b93ce0598116fd3b874800a67b8b9434cd54a009f2be5fd0809.jpeg",
"thumbnail_destination_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Danny_DeVito_by_Gage_Skidmore.jpg/1200px-Danny_DeVito_by_Gage_Skidmore.jpg",
"image_resolution": "1200 × 1427",
"snippet": "Daniel Michael \" · Danny\" · DeVito, Jr. (born November 17, 1944) is an American actor, director, producer and screenwriter. He has starred in and directed a number ...",
"cached_page_link": "https://webcache.googleusercontent.com/search?q=cache:2DR2mxjaZbsJ:https://simple.wikipedia.org/wiki/Danny_DeVito+&cd=32&hl=en&ct=clnk&gl=us",
"related_pages_link": "https://www.google.com/search?q=related:https://simple.wikipedia.org/wiki/Danny_DeVito&sa=X&ved=2ahUKEwi7uom3wJ_xAhWxHDQIHct6DmQQHzAfegQIFhAQ"
},
...
]
Check out the documentation for more details.
Disclaimer: I work at SerpApi.
Below is one Json item returned from this query and this is the query:
https://www.googleapis.com/customsearch/v1?key={key}&cx={key}&q=Action+Motivation%2c+Inc.&alt=json
The "dc.type" in the Json is "Patent" and this is obviously patent data BUT I didn't specify that search engine. I've googled this to death but can't find anything re why patent data would be returned from a simple query like this. If Google "Action Motivation, Inc." on the regular google.com page, I get completely different (normal) results. Has anyone had this problem?
"items": [
{
"kind": "customsearch#result",
"title": "Patent US5622527 - Independent action stepper - Google Patents",
"htmlTitle": "Patent US5622527 - Independent \u003cb\u003eaction\u003c/b\u003e stepper - Google Patents",
"link": "https://www.google.com/patents/US5622527",
"displayLink": "www.google.com",
"snippet": "Apr 22, 1997 ... Original Assignee, Icon Health & Fitness, Inc., Proform Fitness ....",
"htmlSnippet": "Apr 22, 1997 \u003cb\u003e...\u003c/b\u003e Original Assignee, Icon Health & Fitness..."
"formattedUrl": "https://www.google.com/patents/US5622527",
"htmlFormattedUrl": "https://www.google.com/patents/US5622527",
"pagemap": {
"book": [
{
"description": "A motivational exercise stepping machine has a pair of independently operable pivoting treadles for operation..."
"url": "https://www.google.com/patents/US5622527?utm_source=gb-gplus-share",
"name": "Patent US5622527 - Independent action stepper",
"image": "https://www.google.com/patents?id=&printsec=frontcover&img=1&zoom=1"
}
],
"metatags": [
{
***"dc.type": "Patent"***,
"dc.title": "Independent action stepper",
"dc.contributor": "William T. Dalebout",
"dc.date": "1994-3-23",
"dc.description": "A motivational exercise stepping machine has a pair of independently operable pivoting treadles for operation by a user's feet. Each treadle..."
"dc.relation": "JP:S5110842"
}
]
}
},
{
When using their API, you can issue around 40 requests per hour. The results you see on the API is not what the real user sees. You are limited to what they give you, it's not really useful if you want to track ranking positions or what a real user would see. That's something you are not allowed to gather.
If you want a higher amount of API requests you need to pay.
60 requests per hour cost 2000 USD per year, more queries require a custom deal.
I'm trying to devellop a facebook app using custom stories and objects using js sdk but i met some problems.
What i try to achive is to create a story like:
"John played football on MyApp.- with Mike and Kate at city stadium"
under the text to be an image, a title and some description and on click goes to a link.
I have defined my action "Play" and my object "Football".
The action code facebook gives is:
FB.api(
'me/myapp:play',
'post',
{
football: "http://samples.ogp.me/xxxxxxxxxxxx"
},
function(response) {}
);
The object code facebook gives is:
FB.api(
'me/objects/myapp:football',
'post',
{
app_id: myappid,
type: "myapp:football",
url: "http://samples.ogp.me/xxxxxxxxxxx",
title: "Sample Football",
image: "https://fbstatic-a.akamaihd.net/images/devsite/attachment_blank.png",
description: ""
},
function(response) {}
);
However I used it as follows:
HTML:
<a onclick="playFootball();" href="#">Play Football</a>
JS:
function playFootball() {
FB.api(
'me/testapp-radu:play',
'post',
{
tags: "xxxxxx, xxxxxx,",
place: "https://www.facebook.com/pages/MyPlace/xxxxxx?ref=br_rs",
football: "http://samples.ogp.me/xxxxxx",
image: "http://www.peter-ould.net/wp-content/uploads/soccer-ball.jpg",
privacy: {'value': 'SELF'}
},
function(response) {});
}
and the result was this:
http://img545.imageshack.us/img545/337/yj9o.jpg
I was unable to change "played a football" into "played football".
The title was unchanged despite use of property title, same applies to url and description, also I tried to use an object but still no results.
If someone could help me solve these 2 problems I wold be really gratefull, or at least point me to some basic tutorials (facebook documentation sometimes is confuzing for me).
I think you are using football as a wrong way of specifying your story. You are using name of the instance instead of class. Let me explain.
Following are the two scenarios I could come up with:
Your app is about games that users play. So in this case your object becomes game and football will be the name of the game. So now your story reads like:
"A played football with B and C via your_app" since you will be providing the name property of the game object, facebook will select the right story sentence for you
Your app is about sports products, in which case your object becomes sport_product or product and football will be an instance of sport product. But in this case an action of play does not make any sense. So lets say buy is an action. So now your story reads like:
"A bought football with B and C via your_app"
Also if you think about it football does not make sense as an object. What would be the value of the name property of football, "Kaka's football" - does not make sense. Think in terms of a generic class of object rather an instance. (Think Movie not Inception).
Sample Story
Hope this makes sense!