Code Monkey home page Code Monkey logo

clarifai-android-starter's Introduction

Clarifai Android Starter

This is a simple project showing how to use the Clarifai API in Android. It uses the Clarifai Java Client to perform Concept recognition.

Building and Running

To set your environment up for Android development, you'll need to install the Java SE Development Kit (JDK) and Android Studio.

Replace YOUR_API_KEY_HERE with your Clarifai API Key in strings.xml.

This project will compile in the standard manner through Android Studio or ./gradlew clean build in your terminal.

Where to look

RecognizeConceptsActivity contains most of the non-boilerplate code. In particular, RecognizeConceptsActivity.onImagePicked makes the API call to Clarifai.

You can also look at RecognizeConceptsAdapter.onBindViewHolder to see how we display the information that the API returns to the user.

clarifai-android-starter's People

Contributors

drefrome avatar eddiezane avatar keithito avatar kevinmost avatar rok-povsic avatar zeiler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clarifai-android-starter's Issues

App crashes on certain camera orientations

Depending on the phone, when the camera is in portrait mode, or if the camera is on the left in landscape mode, or if it's upside down, the app crashes out of the box after taking a picture.

android clarifai implementing Exception

com.clarifai.android.starter.api.v2 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.clarifai.android.starter.api.v2, PID: 22534
java.lang.RuntimeException: Unable to create application com.clarifai.android.starter.api.v2.App: clarifai2.exception.ClarifaiException: java.util.concurrent.ExecutionException: clarifai2.exception.ClarifaiException: API call to refresh token unsuccessful
Provided AppID: cc42b10022ba4881a69b84e3bc963992
Provided AppSecret: NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0
Provided BaseURL: https://api.clarifai.com/
Status code: 401
Message: Unauthorized
Details: {"status":{"code":11002,"description":"Invalid credentials","details":"invalid client ID (cc42b10022ba4881a69b84e3bc963992) and secret (NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0)"}}
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4730)
at android.app.ActivityThread.access$1600(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1412)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5437)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: clarifai2.exception.ClarifaiException: java.util.concurrent.ExecutionException: clarifai2.exception.ClarifaiException: API call to refresh token unsuccessful
Provided AppID: cc42b10022ba4881a69b84e3bc963992
Provided AppSecret: NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0
Provided BaseURL: https://api.clarifai.com/
Status code: 401
Message: Unauthorized
Details: {"status":{"code":11002,"description":"Invalid credentials","details":"invalid client ID (cc42b10022ba4881a69b84e3bc963992) and secret (NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0)"}}
at clarifai2.api.BaseClarifaiClient.refresh(BaseClarifaiClient.java:120)
at clarifai2.api.BaseClarifaiClient.getCredential(BaseClarifaiClient.java:84)
at clarifai2.api.BaseClarifaiClient.(BaseClarifaiClient.java:77)
at clarifai2.api.ClarifaiClientImpl.(ClarifaiClientImpl.java:51)
at clarifai2.api.ClarifaiBuilder.buildSync(ClarifaiBuilder.java:75)
at com.clarifai.android.starter.api.v2.App.onCreate(App.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4727)
... 8 more
Caused by: java.util.concurrent.ExecutionException: clarifai2.exception.ClarifaiException: API call to refresh token unsuccessful
Provided AppID: cc42b10022ba4881a69b84e3bc963992
Provided AppSecret: NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0
Provided BaseURL: https://api.clarifai.com/
Status code: 401
Message: Unauthorized
Details: {"status":{"code":11002,"description":"Invalid credentials","details":"invalid client ID (cc42b10022ba4881a69b84e3bc963992) and secret (NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0)"}}
at java.util.concurrent.FutureTask.report(FutureTask.java:94)
at java.util.concurrent.FutureTask.get(FutureTask.java:164)
at java.util.concurrent.AbstractExecutorService.doInvokeAny(AbstractExecutorService.java:163)
at java.util.concurrent.AbstractExecutorService.invokeAny(AbstractExecutorService.java:185)
at clarifai2.api.BaseClarifaiClient.refresh(BaseClarifaiClient.java:92)
... 15 more
Caused by: clarifai2.exception.ClarifaiException: API call to refresh token unsuccessful
Provided AppID: cc42b10022ba4881a69b84e3bc963992
Provided AppSecret: NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0
Provided BaseURL: https://api.clarifai.com/
Status code: 401
Message: Unauthorized
Details: {"status":{"code":11002,"description":"Invalid credentials","details":"invalid client ID (cc42b10022ba4881a69b84e3bc963992) and secret (NhujL3Zy_79qgEeik-XlKNFeS6t-0TR142hUqnd0)"}}
at clarifai2.api.BaseClarifaiClient$2.call(BaseClarifaiClient.java:108)
at clarifai2.api.BaseClarifaiClient$2.call(BaseClarifaiClient.java:93)
at java.util.concurrent.FutureTask.run(FutureTa

Please tell me what is happening with my code.
what should i do?

No connection to Clarifai and module cannot be loaded

Hello,

I keep getting the failure "Error while contacting Clarifai API".
Also it says sometimes during the start of Android Studio that the module "clarifai-android-starter-master.iml" cannot be loaded.

I installed the "Java SE Development Kit 8u161", changed the clarifai core number to 2.3.0 and pasted the API-number in strings.xml.

Any idea, why this should not work?

Change model

How to change the general model to food items model cant do this?

BitmapFactory.decodeStream(...) called twice

Was it intentionally, to have

BitmapFactory.decodeStream(getContentResolver().openInputStream(uri), null, opts);

called twice within the private Bitmap loadBitmapFromUri(Uri uri) method

it is used to return a Bitmap which is why it is returned such as

return BitmapFactory.decodeStream(getContentResolver().openInputStream(uri), null, opts);

but it is also called in the method without returning or assigning it to anything, was this a typo or intentionally?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.