Techno Blender
Digitally Yours.
Browsing Tag

Flask

How to Properly Deploy ML Models as Flask APIs on Amazon ECS | by Nikola Kuzmic | Mar, 2023

Deploy XGBoost models on Amazon ECS to recommend perfect puppiesPhoto by Carissa Weiser on UnsplashWith the wild success of ChatGPT it is becoming apparent just how much AI technology will impact our lives. However, unless those amazing ML models are made available for everyone to use and deployed properly to address high user demand, they will fail to create any positive impact on the world. Hence, why it is so important to be able to not only develop AI solutions, but also know how to deploy them properly. Not to…

Setting up a flask application for Data Science | by Philip Wilkinson | Mar, 2023

The basic structure of a flask application to allow for modular developmentPhoto by KOBU Agency on UnsplashA Data Science workflow often involves the use of notebooks and python scripts. These are great tools but it often means that your outputs can often remain in those files without seeing the light of day. A good way to change that however is by creating a website to show and discuss your findings or an API to serve your model to the rest of the world. One framework that can help in this regard is Flask.Flask allows…

Simple way to Deploy ML Models as Flask APIs on Amazon ECS | by Nikola Kuzmic | Mar, 2023

Deploy Flask APIs on Amazon ECS in 4 minutesPhoto by Arjan van den Berg on UnsplashIn this post we’ll cover how to deploy a linear regression XGBoost model which predicts a developer’s salary based on their years of experience.👉 Game PlanTrain an XGBoost modelBuild a simple Flask API to serve model predictionsBuild a Docker Image for the Flask APIDeploy the Docker Container on Amazon ECSEntire Source Code Github Repo: link🧑‍💻flask-on-ecs - repo structure.├── Dockerfile├── README.md├── myapp.py├── requirements.txt└──…

Introduction to ML Deployment: Flask, Docker & Locust | by Antons Tocilins-Ruberts | Feb, 2023

Learn how to deploy your models in Python and measure the performance using LocustPhoto by İsmail Enes Ayhan on UnsplashYou’ve spent a lot of time on EDA, carefully crafted your features, tuned your model for days and finally have something that performs well on the test set. Now what? Now, my friend, we need to deploy the model. After all, any model that stays in the notebook has a value of zero, regardless of how good it is.It might feel overwhelming to learn this part of the data science workflow, especially if you…

Using Request Args for a Variable URL in Flask

This article will teach us how to use Request Arguments in our Flask application. First, we will understand. What are the Request Arguments?What are the Request Arguments?Request Arguments are MultiDict objects with the parsed contents of the query string (the part in the URL after the question mark).MultiDict:  It is a dictionary-like structure, having key-value pairs, but the ‘same key’ can occur multiple times in the collection.In Flask, we can use the request.args attribute of the request object to access the URL…

Uploading and Reading a CSV File in Flask

Flask is a flexible, lightweight web-development framework built using python. A Flask application is a Python script that runs on a web server, which listens to HTTP requests and returns responses. It is designed for simple and faster development. In this article, let’s upload a CSV (Comma Separated Value) file and read the contents of the file on a web page of the browser.Required ModuleInstall Flask by running the pip command in your terminal. Additionally, you may want to install some popular libraries such as…

Making a Flask app using a PostgreSQL database

from flask import Flask, render_template, request, redirect, url_forimport psycopg2  app = Flask(__name__)  conn = psycopg2.connect(database="flask_db", user="postgres",                        password="root", host="localhost", port="5432")  cur = conn.cursor()  cur.execute(        )  cur.execute(        )  conn.commit()  cur.close()conn.close()    @app.route('/')def index():        conn = psycopg2.connect(database="flask_db",                            user="postgres",                            password="root",…

Flask HTTP methods, handle GET & POST requests

In this article, we are going to learn about how to handle GET and POST requests of the flask HTTP methods in Python.HTTP Protocol is necessary for data communication. In the context of the World Wide Web, an HTTP method is a request method that a client (e.g. a web browser) can use when making a request to a server (e.g. a web server). There are several HTTP methods that a client can use when making a request. In Flask, there are different methods to handle HTTP requests. e.g GET, POST, PUT, DELETE, HEAD. These methods…

How To Process Incoming Request Data in Flask

In this article, we will learn how we can use the request object in a flask to process Incoming request data that is passed to your routes and How To Process incoming Request Data in Flask using Python. Flask has some functionality like tools, libraries, and technologies that allow you to build a web application, and Web applications frequently require processing incoming Data requests from users.Process Incoming Request Data in FlaskTo perform Process Incoming Request Data in a Flask Application we will use some request…

How to Obtain Values of Request Variables in Flask

In this article, we will see how to request the query arguments of the URL and how to request the incoming form data from the user into the flask.In a flask, to deal with query strings or form data, we use Request variables.For example, a query string may look like this:google.com/search?q=pythonLet’s start by creating a demo flask project. To be able to request data we will need to import the request from the Flask library.Python3from flask import Flask, request, render_template    app = Flask(__name__)      …