Hello guys.
So in this video we are going to start the Flask Framework series.
Uh, again in this video we'll try to understand about flask why flask is basically used.
What are the key components in flask.
And if you don't know about flask framework it is basically used to develop end to end web application.
What are the features that are present in the flask that we are probably going to discuss.
And as we go ahead, we'll be discussing a lot of practical applications.
And we'll also be doing some projects.
Right.
Um, let's say you are actually planning to become a data scientist, or you are already a data scientist
or working as a machine learning engineer.
We tend to work with, uh, different, different ML application.
You know, uh, we create our own models.
Let's say we are working in generative AI, LM models, and.
All right, at the end of the day, if I, uh, need to just showcase all this particular model in working,
definitely.
I need to create an end to end web application.
Right.
How?
Let's say that if I want to probably create a form, I give the input in that form.
And that form basically interacts with my ML model and gives the response from that particular ML model
itself.
Right.
So all the way we definitely have to use flask framework.
At the end of the day, if you really want to create an end to end web application, then this framework
will be super important for you.
Okay, so in this video and in the upcoming series of video, we are going to discuss about all these
things.
Uh, now let's go ahead and start about Flask Framework.
Uh, what exactly is first Framework?
First of all, we are going to see that.
Then we are going to see about we are going to discuss about two important components in flask framework.
That is w h g I, which is nothing but web server gateway interface.
We will discuss about this right.
Web server gateway interface.
And then we are also going to discuss about Jinja2 right template engine.
So what exactly it is we'll also be discussing about it okay.
Template engine.
So let's go ahead and discuss one by one.
So just to make sure that you focus in this screen.
I'll just keep my video hidden so that whatever things I'm actually writing, you should be able to
follow it.
Okay, now, first of all, what exactly is this flask framework?
Okay.
And it is not like we just have one framework.
There are a lot of different different frameworks like flask, Django, there is fast API, Streamlit.
In the series of videos you'll be seeing that we'll be we'll try to cover that.
But first we will first of all go ahead with Flask framework.
Uh, flask framework.
If I really want to just go ahead with that definition.
It is a complete web framework, web framework which is created, which is created with the help of
Python programming language.
Okay, created with the help of Python programming language.
So this is the definition with respect to the flask framework okay.
Now there are two important key components that I really want to discuss.
One is about WSG.
Okay.
Now in order to make you understand about WSG, I first of all you need to understand what exactly is
a web server.
Let's say I have a web server over here.
Okay so this is my web server.
Web server is nothing but where we specifically deploy our entire applications, you know.
Now this web server may be present in AWS EC2 instance.
It may be available in Azure app right in different different cloud platforms.
It can also be available in Apache.
Let's say if you're working with C sharp dotnet it may also be an IIs server.
Right.
So different different web servers are specifically used based on the requirement.
Nowadays it AWS Cc2 Azure, Google GCP.
These are the common web servers that we specifically use okay.
So if I talk about this web servers, these are the web servers that we will be using.
Now in this web server we deploy our entire web application okay.
We deploy our entire web application.
So let's consider that this is my web app, okay.
And this web app is completely created with the help of Flask framework okay.
This is created by the flask framework.
Now this entire application is deployed in this web server okay.
Now let's say whenever let's say a request comes from any user.
Let's say I want to probably go ahead and see the home page of this particular web app.
So I will be getting the request over here.
So let's say this is my request one request one from the user and user.
This may be my request two this may be my request three.
Like this I may have n number of request.
Now once we send a request to this particular web server, what exactly happens is that this web server
where this web app is deployed.
So this web app is deployed over here right now.
This web server needs to further communicate with the web app, right?
It needs to redirect this particular request to the web app.
So in order to redirect this particular request to the web app and get the response back, okay.
Get the response back.
So this is my request.
We are just redirecting this request to this particular web app.
Let's say if I want to go ahead and see my slash home page over here.
So first of all, the request will come to the web server.
And in this web server this web app is actually deployed.
And this home page will be going to get redirected into this particular web app.
Let's say one URL slash home.
The other URL can be any APIs.
Third URL can be any functionalities that we really want to use in this particular web app.
Okay.
Now in order to redirect this and communicate with the web app, we will be using an very important
protocol, right?
Protocol that is nothing but w s g I w g a protocol is nothing but web server gateway interface.
Okay, so let me just go ahead and write it over here.
Web server gateway interface.
Okay.
So this is the protocol that we are going to use.
Now based on this particular protocol the request will get redirected to the web app.
Then this web app will provide some kind of response.
And based on that the response will be sent to the the end user based on the request, what they are
actually sending.
Let's say if they go ahead and search for google.com okay.
I'm just considering okay.
Let's say there is a website, uh, google.com, which is hosted in this particular web server.
And it has been developed with the help of flask framework.
If I go ahead and write google.com so it will go over here, this request will come over here.
Then with the help of Wsgi it will interact with this particular web app.
How that particular request needs to be handled.
It will be taken care over here.
And finally we get the response and here we will be able to see the google.com based on the request
or one or request two or request three.
So that is the reason why this web server gateway interface is very much important.
And flask framework basically uses this so that the communication between web server and web app actually
happens based on the request that is sent by the end user.
Okay.
So this was the first thing that we really need to discuss about.
The second amazing feature about flask is that it has this Jinja two technique.
It has this Jinja two template engine.
Okay.
What exactly is this Jinja two template engine?
Let me just go ahead and probably explain you okay.
Jinja two if I probably consider as ginger.
Ginger two.
Right.
It is nothing.
But it is a web template engine a very important point.
Web template engine.
Now what is the work of this particular web template engine?
Okay.
The main importance of this web template engine is that it combines a web template or it combines a
web template.
Web template basically means any pages, any pages, like pages in a website with a data source, okay.
With a data source.
We'll be seeing a lot of example.
What does this basically mean?
Now what happens if we combine a data source with the web template.
Let's say I have this specific page.
Or in order to make you understand what exactly is data source, see this data source can be a SQL DB.
It can be a CSV sheet okay.
It can be a ML model from where we will be getting some kind of response.
It can be a MongoDB where we will be able to fill some data over here, right?
It can be any kind of data source.
From this particular data source, we will be getting the data inside this particular web template.
And this entire web page will get loaded right.
Web page will get loaded okay.
Now what does this basically mean.
And let me take an a very a simple example.
Let's say I want to create a web page.
Now inside this web page I may have a scenario.
Let's say there is a there's a place okay.
Over here a upload button okay.
And this upload button basically uploads an image.
And let's say my task is to classify whether an image is a dog or a cat.
Let's say I go ahead and upload a image and let's say this is my dog or cat or whatever thing you have.
So let's say that this is my cat.
As soon as I submit this right now, this information, this information that I have in my page, web
page, it goes and interacts with what?
Let's say one of my data sources ML model.
Now this ML model is specifically going to give you a response saying that, hey, whether the image
is a cat or a dog, let's say it says cat.
Right now this cat information is basically coming from this particular data source okay.
There may be other scenario.
There may also be one example.
Let's say I create a login form.
After login what will happen?
I will put my username I will put my password.
This will get authenticated from where from a specific database.
Once it gets authenticated it is going to put some more information over here inside this particular
web page.
So from some data source right here, all we are doing is that we are combining a layout of a page with
a data source right to create.
And this is very much important.
Finally what we are able to create we are creating, okay.
We are creating.
Dynamic web pages.
Right.
So this is the importance with respect to our introduction with respect to flask.
You really need to understand about this two important module that is available in Frost Framework,
through which the entire flask actually works right now in the upcoming videos.
What I am actually going to do is that we are going to go ahead and see more practical application,
and we will be doing the entire coding.
But this is just to give you an idea like how does a flask framework basically work?
Okay.
Two important things that you have.
One of the protocol is Wsgi, which will actually help you to communicate with the web server along
with the web application.
And the second thing is Jinja2 template engine, which will take a layout, and it will be able to integrate
with the data source so that you create dynamic web pages.
So yes, this was it from my side.
I will see you all in the next video.
Thank you.