Python Machine learning Web Api - python

Hi I would like to do a machine learning hello world, e.g. the Iris data set. I would then like to create a web API (RESTful service) to allow a HTTP Post request to send over (petal_length, sepal_length) and get back the prediction on the type of Iris.
I intend to use Scikit learn but what should I use to make a web API? what do people normally use to make a ML Web API?
Django, I know about this for making websites but I am not sure if it is used for web APIs. http://www.django-rest-framework.org/
Flask, I have also heard about this one but never used it before. http://flask.pocoo.org/
I would like to write unit tests and integration tests. It will also need to use authentication to ensure users have access. Currently my Web API for authenticating users is an ASP.Net Core Web Api and I use JWT.

Flask is just fine for ML API purposes only. It took me very little time to install and configure Flask API and write first API functions calling 3rd party ML API and reformulate its feedback matching to needs. I have added internal ML classifiers modification and usage API functions later.
Instructions:
http://flask.pocoo.org/docs/0.12/deploying/

Related

In the new Google Photos API (Sep 2018), does the discovery API return uploads() as an endpoint?

I am using the Google API client in Python3.
All the examples always go about using discovery.build to create a service and then perform actions using that.
So... I don't think uploads as described here are possible simply using the API. Is that right?
https://developers.google.com/apis-explorer/#p/discovery/v1/discovery.apis.getRest?api=photoslibrary&version=v1&_h=2&
Is the way folks solve this by making a request and not relying upon the google API client?

NodeJS and Python combined architecture?

Could you give me an idea/concepts (not in code) on how could I link NodeJS and Python?
Let's say,
I have NodeJS up and running in PM2 (assuming I already know REST API) and I have a ton of data sets that I need to be ready to display to client side using socket.io (assumming I already know socket.io) as soon as possible.
I'm thinking to use Python. This is for me to implement the basics of machine learning.
In what concept should I start? I'd really love to hear your ideas.
Well you seem to be assuming way too many things, okay from your description I would suggest you to have a look at concept called microservice architecture.
This is how it will work let us assume you want to build an online shopping application where you have 2 main scenarios first is sell all items on your website and second you want to recommend products to your user(Your ML comes into play over here)
So as you said you already know REST API so what you would do is create a microservice (Consider it as a small nodejs application(Using either express or sails or any other framework) which has APIs exposed for all shopping related business logic) also you end up using fromtend technology viz. angularjs for your client side code. You'll show all this shopping stuff by calling your nodejs REST APIs from your angularjs client code. Node provides socket support via socket.io.
Similarly you write a small microservice in python(using Flask and Python-SocketIO) which takes your huge amount of data from datastore does all ML magic and returns recommended products for the particular user(which you received from your angularjs client application), and return it using Python-SocketIO to angularjs(or node application if you're maintaining your frontend logic there instead of angular).
You have provided very less detail so this is abstract view of what you can look into.
Since you're Python oriented for your ML code I'd suggest you to reduce the list of skills you need to learn and/or improve using Python for everything.
You could use Python-SocketIO and Flask, for example.

Service management using RESTful requests

I am currently working on a project where we need to establish communication like an ESB, between a REST API and the apps services on a small scale.
Scenario:
Assume a web app front end (e.g. Django/Python or Ruby/Rails) and services that are accessible via a HTTP RESTful request.
How can I:
make it configurable which web services are called on a web request depending on the request and not requiring code changes (through keys for example)
encapsulate or implement the services in a way to make it easy to manage them e.g. start/stop etc.
I have been looking at spring.io, but cant work out whether this could be used for the this??
I am open to all suggestions,
Thanks
From what I understand, you want an authorisation solution.
In Rails, Pundit and CanCanCan are very popular. You could also implement it from scratch. Here is a screencast to help you get started.

python web service for a network appliance

As there are so many options to write web service in python, I am a bit confused. I have developed a network appliance, its about Private VLANs.
I want to add to it authenticated web service over HTTPS.
It won't be accessed by regular users. It will be accessed just by other systems looking for some network information. Maybe at a later point I'll build an ajax web client which will use it.
There are endless python options. I am not a web programmer, nor I have the time to be one.
All I need is something each is easy to learn and to implement with the following requirements:
Easy to learn. I just need to expose some sqlite tables/views/queries through authenticated web services.
HTTPS support
basic authentication, where I implement the authentication script.
Any suggestions?
The OS is OpenBSD.
Thanks,
Dan

Python / Django Web service Confusion

I am trying to explore more about web service in Python/Django and to be honest i am quite confused. There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There isn't a 'standard' way, but a lot of people (including me) have used -- and like! -- Django Piston, which is actually also used to create the web service for BitBucket (where piston's source is hosted)
Also, if you're still learning about web services, I can highly recommend the O'Reilly book RESTful Web Services -- although it's a book with a focus on REST (which I agree is the best design pattern for a web service) it also explains RPC and SOAP, too.
There are so many things like SOAPpy, XML-RPC, JSON-RPC RESTful, web service.
This should give you a clue - there are different services out there that use one or more of these mechanisms.
Basically all i want to know is what is the standard way of implementing web service in Python/Django and has anyone implemented in live production environment
There is no single standard way of implementing a web service. This is as true for Django/Python as for other web frameworks.
Different people have used Django in different ways to create a web service to suit their needs.

Categories