Using autoML Rest API - google-cloud-platform

I'm working on a JAVA application that uses Google autoML Rest API to classify images based on a trained model (I trained the model using the web platform directly).
I'm having trouble to send any request to use this API to make predictions or get the existing models, I'm always having a 404 error.
I doubt I don't have the needed permissions to make the call, I used OAuth2 to authenticate but still having the same problem. I'm pretty sure that the authentification is correct because I tried it on another API that requires it and it worked fine.
Furthermore, I've been working with the google video intelligence API and I didn't have this problem.
for example, if i would like to get the existing models, I send the following GET request:
Request URL : https://automl.googleapis.com/v1beta1/Project-ID/models
Error message : The requested URL
/v1beta1/Project-ID/models was not found on this server.
Any idea of the cause of this error?

According to the documentation for listing models, the endpoint that AutoML it's using is the following:
https://automl.googleapis.com/v1beta1/projects/${PROJECT_ID}/locations/us-central1/models
Where ${PROJECT_ID} should be your current Project ID

Related

How to intergarte react native front end with django backend

Post Method Used In ReactNative
Error raised
Forbidden: /api/login/
I created a user API using djangorest framework and it is functioning well, however i dont know how to add it to my react native front end for authentication. I would like users to login and the drf to authenticate them. Is there a tutorial i can follow, i tried to look at a few but they didnt work for me. I'm new to react native. Would appreciate elaborate answers and shared resources
Currently using expo cli and unable to fetch data from drf(django rest framework).
is there a way i can request my post method to use djangosessions for authentication instead of auth tokens
the method in the image only works if
'rest_framework.authentication.SessionAuthentication',
is disabled and this is used to get data in api so it cannot be excluded
welcome to ReactNative
You can use different libraries to handle an api request.
Take a look at axios:
https://github.com/axios/axios

Displaying data retrieved through GraphQL in a Django website

(Disclaimer : I'm just getting started with Django, and with web dev in general)
I have a backend app that stores different kinds of resources. Some are public and some are private. The application is accessible only to identified users. A GraphQL API allows me to access the resources.
On another server, I'd like to create a website that will be accessible to everyone. I want to use Django to create it.
The website will display a list of resources tagged as "public" in the backend app, with a pagination system and, say, 20 resources by page. The CSS will differ from the backend app and there will be a search section.
From what I understand, I should be able to retrieve the data through the GraphQL API, but I'm a bit confused here. All the documentation and tutos I can find about Django and GraphQL seem to be about setting up a GraphQL API server with Django. All I want to do is to build custom queries and to display them on my different html pages.
How can I do that? Where should I start?
You should connect your project with a GraphQL client. As per my research, I have found that there are implementations and examples for graphene-mongoengine in Flask (Flask has a direct GraphQL client).
Mongoengine Flask with GraphQL Tutorial
For Django you can check this out
Edit- I was able to get the data from my database with python-graphql-client. Now I am able to display them in my template.
Let me know if this helps

Exposing API Endpoints for AI Application Deployed on Google AI Platform

I have deployed an AI model on Google Cloud Platform in the 'SavedModel' format. The model is able to make predictions when I enter sample input data through the 'Test & Use' facility on AI Platform.
Now, I would like to expose API endpoints so that other front end applications (eg. Android) can make use of this deployed model. What is the procedure to do so? I could not find much help in the documentations provided by Google.
I'm not 100% clear on your requirements, but you can make REST API calls with cURL.
ACCESS_TOKEN="$(gcloud auth application-default print-access-token)"
curl -X POST -d '{json-input}' https://ml.googleapis.com/v1/projects/{project-name}/models/{model-resource-name}:predict\?access_token\=${ACCESS_TOKEN}
Other resources:
https://cloud.google.com/ml-engine/docs/online-predict#requesting_predictions
https://cloud.google.com/ml-engine/docs/v1/predict-request#http-url-format
There are a lot of path's in order to serve your custom model but to make a concise answer to that question but you can deploy your custom model through an API endpoint following this workaround:
Upload your model into a bucket.
Create a model resource
Create a version.
Deploy
Once it's deployed, you can call the endpoint in your front-end applications.
(Bear in mind that batch predictions are not implemented on Python 3.x yet)
Endpoint URL request syntax:
POST https://ml.googleapis.com/v1/projects/{my-project}/models/{my-model}/versions/{my-version}:predict
Not specifying a version would redirect the request to your default version.
Here's some further information about prediction using the Java library an overview about ML Engine predictions.

FB Graph API - cannot enter with my own App token

i facing an issue regarding the FaceBook Graph API.
actually a friend of me, have an FB App whitch can be used for the Graph API.
But in that case I activate a FB dev APP for myself, i'm not able to generate a valid security Token with the App-ID and App-Security.
At first the App is live and activated. For that I don't understand the error message at the end.
Second I don't want to have a User-Token with a validation for an hour.
These are the step's i following:
getting App Token
https://graph.facebook.com/oauth/access_token? client_id=20179479xxxxxx&client_secret=3048xxxxxxxxxxxxxxx&grant_type=client_credentials
The result i'm receving:
"access_token": "20179479xxxxxxx|Pqxxxxxxxxxxxxxxxxx",
Now if im trying to use the Graph API Explorer and trying these token as authentication, I'm facing an #200 OAuthexception
my request:
Get -> /v2.12/coca-cola
"(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/205942813488872/",
Have somebody any ideas how to solve or what i'm missing here?
With the Security Token from my friend he can use the example with coca-cola from the developer like in the documentation and example from FaceBook as well.
Thanks in advance
Facebook is changing the API due to a security issue. This means new apps have more restrictions and less access (for the minute) than apps that were already registered and using the API, probably why your friends key works. Seen as your app is either new or hasn't recently accessed the data you are requesting, you currently cannot fetch it.
Its not known what features will be removed from the API following this incident - as a result I wouldn't come to rely to heavily on any feature the API offers.
Im hearing that the ability to retrieve events could either be removed or the data you can access from an event is going to be severely limited, however thats not from any official facebook source. All apps will be subjected to a review according to this official facebook post, before they are granted access to the Events API, Groups API, and Pages API.

django, google app engine and google drive api

I'm trying to create a simple django project (website) that authenticates the user using OAuth2 and returns a list of files from my google drive account using the drive api v2.
the problem is that I can't get the authentication working, the exception is:
'WSGIRequest' object has no attribute 'redirect'
if someone has managed to get some application going using django mtv file structure get give me some references or a sample project please reply
The sample application can be accessed at: http://helloworldbyionut.appspot.com/home/
If you use app engine, easiest way to do oauth is to use oauth_required decorator. It does all the Oauth2 steps automatically.