From the course: Applied Machine Learning: Supervised Learning

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Querying the model

Querying the model

- [Instructor] Okay, continuing on from our last video, we have Flask running right here and I've got some code here that will access the server. Let's look at the code. We're going to use the requests library. requests is a third-party library that we've installed and it allows us to easily make requests over the web, pun intended. And this is our URL. We're going to hit port 5555 and we're going to hit the predict endpoint here, okay? I've got a little function here called predict. It has some data that we're going to pass in and a URL and there's just some debug, we're going to say, send the data there. We're going to use the requests library to post the JSON data to the URL, and then we're going to get a response. It will be JSON, and I'll just parse the response down here. Okay, here's our data down here. It looks like we've got a male in third class, age 55. Siblings and parents, one. Parents and children, two. They paid $151 and they embarked from S which I believe is South…

Contents