Hi,
I am a bit lost on the how to integrate the vision api into my android (java) projects.
1. I have add the :
Hello @YanivBelo,
you can specify the path to the application_default_credentials.json file in your code to authenticate your Vision API requests.
For example:
-----
import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.vision.v1.ImageAnnotatorClient;
import com.google.cloud.vision.v1.ImageAnnotatorSettings;
import java.io.FileInputStream;
import java.io.IOException;
public class VisionAPIUtil {
public static ImageAnnotatorClient createImageAnnotatorClient() throws IOException {
// Specify the path to your credentials JSON file
String credentialsPath = "<path/to/your/credentials/file>";
// Load the credentials
GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream(credentialsPath));
// Create the ImageAnnotatorClient with the credentials
ImageAnnotatorSettings settings = ImageAnnotatorSettings.newBuilder()
.setCredentialsProvider(() -> credentials)
.build();
return ImageAnnotatorClient.create(settings);
}
}
-----
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |