FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. To learn more about FastAPI, you can visit the docs of FastAPI by clicking here.

FastAPI also provides Swagger UI by default in the {base_url}/docs for testing apis.

Installation

pip install fastapi

You will also need an ASGI server, for production such as Uvicorn or Hypercorn. We will be using uvicorn for this article.

Uvicorn is a lightning-fast ASGI server implementation, using uvloop and httptools.

Until recently Python has lacked a minimal low-level server/application interface for asyncio frameworks. The ASGI specification fills this gap, and means we’re now able to start building a common set of tooling usable across all asyncio frameworks. …


Image for post
Image for post

First step is to select your project if not selected. Here, my project id is bigquery-sandbox-281102 and the highlighted yellow text in project id shows that it is already selected. If it is not activated, you have to select project id by typing:

gcloud config set project [project_id]

NumPy is a library which provides fast alternative to math operations in Python. There are several data types in NumPy like Scalar, Vector, Matrix and Tensors which represents the dimensions of data. Scalar represents empty tuple i.e., zero dimension, Vector is one-dimensional, Matrix is two-dimensional with rows and columns. Tensors are just like Vectors and Matrices but can have more than two dimensional data shape.

For example: You may have a vector, which is one dimensional but need a matrix which is two dimensional. You can follow two ways.

Let’s assume you have the following vector:

v = np.array([5,6,7,8])

If you print v.shape then you will get (4,). Here you are not getting another number because vectors are one dimensional and python doesn’t understand (4) as a tuple with one item. So there must be comma. So, the tuple includes the number and a comma. …


Image for post
Image for post
Busy in pose after hardcore programming on AI

About

Pujan Thapa

Data Engineer In Making…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store