Skip to content

Lab Assignment 5

saismaran33 edited this page Dec 21, 2017 · 1 revision

Image Predictor Application

Install the App through Android Studio

The application that we have built is installed in phone by USB Debugging. The logo is the default android logo because we have not added any specific logo to the application. The application is circled in red color in the above image.

Launcher Activity

This is the launcher activity of the Image Predictor application which consists a button and a background image. I have used Intent class for the button to transfer it to the next activity.

Permissions

Image Predictor application takes the image from the gallery. So, it should ask for the permissions from the user to access the photos, media and files on the device. This is permission taken from the user. If the user presses "Allow" then Image predictor application can access the media and runs successfully. If the user presses "Deny" then Image Predictor application will not have any permission to access the media and it will not work.

Main Activity

This is main activity where we are running CLARIFY API. This page has upload button at the right-bottom of the activity. We can press this button to upload the image from the phone.

Image Population

Here I have populated the image from the gallery of the user device. By clicking the upload button we will get some options to choose the folder from which we can select the image. We can select any image from the gallery of the user phone.

Image Prediction by CLARIFAI

I have uploaded the image of food from the gallery. By using the clarifai api we got a response. The response includes many predicted items based on the content of the image. The response also indicates the probability value for each. The highest probability value is best prediction.

We need to send the option with highest probability to the BestBuy API and it will say in which locations we can find that item.

But the BestBuy is not generating API KEYS for the free mails or edu mails.

I have tried Supermarket API and I got the entire XML data by giving the input as some key. I have parsed the XML data in android studio to get the clean list of output. But I had a problem while joining both the API's. I tried 3-4 times by adding the supermarket API to the Image Predictor application then my application got crashed. So that is the reason why I have not included that part in my assignment.

Supermarket API Call

http://www.supermarketapi.com/api.asmx/COMMERCIAL_SearchByProductName?APIKEY=f87003c347&ItemName=Food

API Key : f87003c347 ItemName : Food