WEBVTT

00:05.230 --> 00:06.840
Hi everyone welcome back.

00:06.840 --> 00:11.720
So in this book you are going to be starting with the classification class which is really where all

00:11.740 --> 00:12.830
the heavy work goes.

00:12.840 --> 00:13.530
OK.

00:13.710 --> 00:16.710
So first of all we need to talk about a couple of things.

00:16.710 --> 00:24.090
OK so we'll going to first open Firefox and we're going to go to a link so we're going to write Tancer

00:24.120 --> 00:28.920
flow and then we're going to write in section v3.

00:28.950 --> 00:29.590
OK.

00:29.940 --> 00:31.660
So inception version 3.

00:31.770 --> 00:32.580
OK.

00:32.670 --> 00:35.010
When you write it you should see the first link here.

00:35.010 --> 00:41.820
Image recognition if you click on it and then go inside there you to see that you know they give you

00:41.820 --> 00:43.710
a model and then they talk to you.

00:43.800 --> 00:49.890
If you go down to use you as an API then you're going to see that there is a file called classify underscore

00:49.890 --> 00:51.210
image doppio.

00:51.450 --> 00:56.670
And it's very simple you're just going to go into this link so it's going to tell you go to this link

00:56.670 --> 00:59.740
start by cloning this links are going to click on this link.

01:00.000 --> 01:05.340
It's going to open a good repository with all the models of the answer flow and then what you're going

01:05.340 --> 01:11.840
to go is you're going to go to models tutorials image and then Image it.

01:11.880 --> 01:15.590
So we're going to go come here and then you're going to this is already on Mars.

01:15.600 --> 01:18.520
If you look at the or there's already models here.

01:18.540 --> 01:21.940
So what you're going to do is let me try to make this bigger.

01:22.020 --> 01:22.870
You're going to go.

01:22.920 --> 01:25.470
Let's see if we can make a slightly bigger Yes.

01:25.530 --> 01:26.440
There we go.

01:26.620 --> 01:28.560
I'm sure you're going to go into tutorials.

01:29.400 --> 01:35.960
And then we're going to go into image and then Image net and then you should see or classify underscore

01:36.020 --> 01:37.070
and Match.com.

01:37.220 --> 01:42.390
OK so we're going to click on this year we want to copy all of this file files are going to take this

01:42.390 --> 01:44.970
file from start go all the way up.

01:45.030 --> 01:50.110
Copy all this file because this is the file that we're going to be using to classify them.

01:50.150 --> 01:50.620
Great.

01:50.700 --> 01:54.040
So I'm going to copy this file and then I'm going to come here.

01:54.210 --> 01:57.530
Can I see this year and make a new document.

01:57.660 --> 02:07.070
Paste this and then control s go into desktop and then into misclassification web.

02:07.200 --> 02:11.210
And then I'm going to save it here as classify.

02:11.520 --> 02:18.640
So underscore image wise I've just downloaded this file and saved it here and that's it.

02:18.660 --> 02:23.820
OK so this model is supposed to be able to train an image that you give it.

02:23.820 --> 02:27.600
And I'm going to show you how you can use it in this video.

02:27.600 --> 02:28.200
OK.

02:28.470 --> 02:34.340
So first of all the thing that we were going to do is we just look.

02:34.370 --> 02:40.670
So first of all I want I want us to look at the file and just get a feel of how this is working.

02:40.710 --> 02:43.000
Before we actually use the file OK.

02:43.350 --> 02:48.780
So the first thing is when you call this file it first get some arguments OK.

02:48.810 --> 02:51.790
So you pass some arguments into this file.

02:51.810 --> 02:54.990
So the first argument is the model directory.

02:54.990 --> 02:58.460
So you need to download it where you download the model directory from.

02:58.470 --> 02:59.090
OK.

02:59.190 --> 03:01.730
So this model is what we're going to download.

03:01.740 --> 03:02.090
OK.

03:02.100 --> 03:09.150
So this model is if you go here if you go here you're going to find there is a right or in the first

03:09.150 --> 03:09.390
link.

03:09.390 --> 03:15.660
So if you go back you're in this link here we're going to find full data underscore your else.

03:15.660 --> 03:17.060
Let me just zoom in here.

03:18.240 --> 03:19.700
So go down.

03:19.860 --> 03:25.110
You're going to find that your ally here and this is where the model is going to come from.

03:25.260 --> 03:27.420
So we're going to copy this thing here.

03:27.540 --> 03:28.190
OK.

03:28.230 --> 03:34.740
Because we want to download the model locally and then we're going to go here and then paste and then

03:34.740 --> 03:35.770
click enter.

03:36.090 --> 03:38.670
Now it should tell you to save up to save the model.

03:38.670 --> 03:41.120
So the inception model is very big.

03:41.250 --> 03:47.000
It's actually if not super big race 85 megabytes or relatively big.

03:47.160 --> 03:48.610
So you're going to save the file.

03:48.630 --> 03:55.050
I already downloaded it so I won't download it again but once you download this file then you're going

03:55.050 --> 03:56.070
to go.

03:56.420 --> 04:00.590
So you're going to close that and then you're going to go to where you downloaded it.

04:00.630 --> 04:04.750
So in my case I've downloaded the model on the desktop so you can see it here.

04:04.760 --> 04:06.380
Inception here.

04:06.480 --> 04:07.770
So I'm going to cut this.

04:07.770 --> 04:10.970
And then I copy it going to image classification.

04:11.280 --> 04:16.780
And then what's so image classification wrongful there I guess.

04:16.890 --> 04:18.910
So image classification folder.

04:19.170 --> 04:21.800
And then I'm going to go into web and then I'm going to paste it here.

04:21.810 --> 04:23.010
So I'm going to leave it here.

04:23.040 --> 04:23.670
OK.

04:23.770 --> 04:27.350
So paste it paste this thing here and that's it.

04:27.360 --> 04:28.170
That's it for me.

04:28.170 --> 04:33.410
So I'm just going to leave the model here and you can see why I've left it here in a few seconds.

04:33.780 --> 04:35.190
OK so what is this doing.

04:35.400 --> 04:37.080
Let's go back to the arguments.

04:37.270 --> 04:39.010
Let's let's zoom out a bit.

04:39.150 --> 04:42.580
So first of all we need a model directory so it's selling.

04:42.630 --> 04:48.970
We need to tell tensor flow which model to use to predict what classification the images.

04:49.020 --> 04:54.960
So what model is going extensor flow going to use to predict whether this is an animal or a zebra or

04:54.960 --> 04:56.190
a giraffe or so on.

04:56.190 --> 04:56.980
OK.

04:57.390 --> 05:03.210
The second argument is image files so you need to give this file of your an argument which is image

05:03.210 --> 05:03.660
file.

05:03.810 --> 05:11.250
And this image files that you are to an image where where it can infer what or classify this image.

05:11.250 --> 05:13.440
This is the image that we want to classify.

05:13.440 --> 05:13.710
Right.

05:13.710 --> 05:16.480
This is the image that we're going to be sending out.

05:16.770 --> 05:19.870
And then also number of predictions.

05:19.920 --> 05:22.710
So how many predictions do you want.

05:22.710 --> 05:28.330
So for example if you remember when we were talking about the API that is going up to give you the top

05:28.330 --> 05:29.960
five predictions.

05:29.950 --> 05:36.690
So for example it might give you the first one is 80 percent the second one is 5 percent.

05:36.690 --> 05:40.530
The second 31st percent 2 percent 1 percent and so on.

05:40.530 --> 05:40.920
Right.

05:40.980 --> 05:47.880
So it's going to give you the percentages but in descending order of how positive it is off this prediction

05:48.840 --> 05:55.340
and then another thing is going to parse all these arguments and put it in flags.

05:55.350 --> 06:00.520
So it's going to put flet into it into flags and then it's going to say denser flow.

06:00.540 --> 06:02.980
Please run the function main.

06:03.030 --> 06:03.550
OK.

06:03.630 --> 06:05.520
So let's go back to the function menu.

06:05.520 --> 06:07.220
So this is the function main.

06:07.620 --> 06:12.370
So first of all it's going to be to call the function maybe download and extract.

06:12.450 --> 06:18.330
So this function what this is what it was what it's going to do is if you have the model this inception

06:18.330 --> 06:20.490
model then it's not going to do anything.

06:20.520 --> 06:21.760
It's just going to return.

06:22.020 --> 06:27.700
But if you don't there is going to use this data you are all here to download them all.

06:27.840 --> 06:29.740
And that is going to return.

06:29.760 --> 06:30.440
OK.

06:30.480 --> 06:33.820
So in other words even if I remove this.

06:33.840 --> 06:38.530
So let's go see you in Maine here even if I remove this line.

06:38.640 --> 06:40.050
This file would still work.

06:40.060 --> 06:40.250
Right.

06:40.260 --> 06:46.220
But I'm just going to leave now the second thing is going to find that you are EHLO that image.

06:46.220 --> 06:51.510
So it's going to get to you or of that image that you want to classify.

06:51.600 --> 06:55.070
And then it's going to call the function run in friends an image.

06:55.080 --> 06:55.600
OK.

06:55.650 --> 06:57.360
So it's going to inference.

06:57.390 --> 07:02.890
So if you have an image and we want to do some inference on you know what's inside of it.

07:02.910 --> 07:10.560
So if I go to run interference on and let's say if I go to the function it says run introns an image

07:10.560 --> 07:14.820
so it takes an argument or an image file and then it returns nothing.

07:14.900 --> 07:17.740
OK so what is going to do is do.

07:18.000 --> 07:20.430
It's going to do some machinery new stuff.

07:20.450 --> 07:26.970
So we're not going to go into too much details since everyone might know what machine learning is or

07:27.210 --> 07:27.840
how to use.

07:27.840 --> 07:32.080
Actually the answer to most people no machinery used but how to use underflow.

07:32.280 --> 07:38.670
But it's basically going to start predicting what this image might be and then if you come down here

07:38.670 --> 07:43.290
you're going to say top k is equal to predictions are X or it.

07:43.440 --> 07:47.080
So it's going to get to sort of prediction in descending order.

07:47.100 --> 07:54.390
So it gives you the best the best prediction for example 80 percent prediction a panda or a zebra.

07:54.510 --> 07:56.070
Then it's rancid.

07:56.070 --> 08:05.700
The number one right so cupcake is going to be two to sort the predictions that the model here predicted

08:06.150 --> 08:13.380
and then is going to go for each one of them is going to score is equal to prediction of ID and then

08:13.380 --> 08:22.360
it's going to pre-print the human strain so the human strain here is basically zebra or that's a giraffe

08:22.450 --> 08:24.980
or human or Angelina Jolie.

08:25.030 --> 08:30.000
So the mystery here is what this model thinks this image is off.

08:30.130 --> 08:33.880
And then the score is the percentage of how confident it is.

08:33.970 --> 08:41.290
So for example I'm 30 percent sure that this is Angelina Jolie or I'm 40 percent sure that this is bracket.

08:41.320 --> 08:41.920
OK.

08:42.070 --> 08:49.520
So we it's going to print what what it thinks the prediction is and how confident it is off this prediction.

08:49.520 --> 08:51.460
OK for each of the predictions.

08:51.480 --> 08:52.370
All right.

08:52.700 --> 08:54.450
Hopefully this makes the sense.

08:54.550 --> 09:01.670
So when we're writing the classify function what we're going to do is actually we want to get this top.

09:02.500 --> 09:05.400
Dictionary that has all the predictions right.

09:05.500 --> 09:10.720
So we got what we're going to do is we're going to you're right in this fight we're going to call this

09:10.720 --> 09:11.300
fight.

09:11.360 --> 09:11.750
OK.

09:11.800 --> 09:13.910
We're going to call this a subprocess.

09:14.140 --> 09:17.440
And given the image file and give it all the other stuff.

09:17.680 --> 09:25.420
And then this file is going to predict the what this image is and that it's going to write in this directory

09:25.420 --> 09:26.130
over here.

09:26.150 --> 09:29.930
It's going to write a file with a dictionary.

09:30.520 --> 09:38.170
Then once this happens in Abu Dhabi why I'm going to read this file which has the predictions and then

09:38.200 --> 09:40.580
I'm going to load it into a dictionary.

09:40.770 --> 09:43.020
So you're going to see what I mean by that.

09:43.030 --> 09:44.930
And if just a few seconds.

09:44.950 --> 09:46.640
So first of all let's write the class.

09:46.640 --> 09:50.710
So class classify resource.

09:50.770 --> 09:57.280
So what I did just was I wanted to make sure that you understand even a very high logic of what's happening

09:57.280 --> 09:58.110
in this file.

09:58.150 --> 10:03.230
So because we're going to come here and we're going to be hitting this area over here in a few minutes.

10:03.250 --> 10:04.300
OK.

10:04.480 --> 10:07.210
So the first thing is we have a class called classified.

10:07.210 --> 10:10.990
So what are we at what what does it support what method does it support.

10:10.990 --> 10:15.550
Post something on his own defined post self.

10:16.750 --> 10:19.680
And then first of all we want to get the posted data as usual.

10:19.690 --> 10:22.970
So you can your request that get your score.

10:23.080 --> 10:25.420
So that's the first thing.

10:25.460 --> 10:31.910
And then the second thing is we're to get the user name is equal to hosted data username.

10:32.050 --> 10:33.870
Right.

10:33.940 --> 10:41.680
And the password of password is equal to posted data and then password right.

10:42.080 --> 10:48.570
So now the third thing we need is you or else we're going to need your elders to posted data.

10:48.880 --> 10:53.110
But then this time is going to be you or L or write code.

10:53.110 --> 10:55.950
So now we have everything that we need.

10:56.170 --> 11:00.730
Now the first thing is well we need to verify the credentials of this user.

11:00.730 --> 11:01.520
OK.

11:01.630 --> 11:07.600
So for this I'm going to write a function just to make this it just do not clutter this area I'm going

11:07.600 --> 11:13.180
to write a function called verify credentials that is given a username and password and it tells me

11:13.180 --> 11:19.210
if there is any error or not and if there is an error it returns to me the return Jaisalmer that I am

11:19.210 --> 11:19.960
going to retrieve.

11:20.170 --> 11:30.360
So when I do return some error is equal to verify credentials username and password.

11:31.550 --> 11:32.420
OK.

11:32.880 --> 11:40.980
So if air is true so if there is an heir so the user name doesn't exist or your name doesn't match the

11:40.980 --> 11:43.890
password then this is going to be true.

11:43.980 --> 11:46.580
And this is going to have the return Jaser.

11:47.010 --> 11:49.300
But there is this is going to be false.

11:49.350 --> 11:50.690
And this is going to be none.

11:50.940 --> 11:51.620
OK.

11:51.900 --> 11:59.410
So I'm not to say if air then returned the sun if I returned Jason.

11:59.430 --> 12:00.100
OK.

12:00.420 --> 12:03.120
So so far I haven't written to verify credentials.

12:03.210 --> 12:04.760
Right so I can put here.

12:04.830 --> 12:10.090
I asked AG to do OK because I haven't done it.

12:10.160 --> 12:11.040
All right.

12:11.160 --> 12:16.590
So the second thing is we need to verify that the user had enough tokens right.

12:16.660 --> 12:23.550
So I say tokens is equal to users that's fine that's fine.

12:23.790 --> 12:31.110
And then I want to find the username with the username that is posted and then got access the first

12:31.110 --> 12:33.510
ones since there is only one of the Great.

12:33.660 --> 12:37.640
And then I'm also going to access the element tokens right.

12:38.620 --> 12:45.980
All right then I'm going to check if tokens is less than or equal to zero that what I want to do is

12:45.980 --> 12:49.650
to return an error of 0 3 not enough tokens right.

12:49.670 --> 12:53.570
You remember from here three or three out of tokens.

12:53.570 --> 12:59.840
So the way I'm going to do this instead of having to do a return Jasen equal to this and then status

13:00.200 --> 13:05.570
and then message right instead of having to do all this for every time I want to retune something I'm

13:05.570 --> 13:07.180
going to write the helper function.

13:07.400 --> 13:08.040
OK.

13:08.250 --> 13:15.810
So I'm going to say If tokens is less than or equal to zero then return Jaison if I.

13:16.310 --> 13:17.030
OK.

13:17.250 --> 13:23.320
And then I'm going to write a new function called let's see let's call it generate return to action.

13:23.430 --> 13:32.780
We generate return dictionary and he's going to have two arguments status and comment.

13:32.830 --> 13:33.320
OK.

13:33.370 --> 13:40.420
So for here I want us I want the status to be three of eight and for the comment to be let's say not

13:40.600 --> 13:43.470
enough tokens.

13:44.360 --> 13:44.960
Right.

13:45.130 --> 13:50.410
So what this is going to do is to generate a dictionary for me with this and this and this message and

13:50.410 --> 13:53.810
return it and then I'm going to just have to fight and return.

13:53.820 --> 13:57.470
So instead of having to do it on multiple lines we can just do it on one line.

13:57.470 --> 13:57.760
Right.

13:57.790 --> 13:59.500
Makes the code much shorter.

13:59.830 --> 14:01.540
So there's also a to do here.

14:01.540 --> 14:06.840
So let's put a hash tag to do here because we still haven't written this function.

14:07.420 --> 14:11.690
So the next thing we're going to do is we want to get the image OK from the euro.

14:11.820 --> 14:13.710
So not to say R is equal to.

14:13.720 --> 14:16.330
So this is how we use requests of an s.

14:16.480 --> 14:19.920
So R is equal to your requests don't get.

14:20.020 --> 14:21.930
And then I'm going to put the U R L in there.

14:21.970 --> 14:22.630
OK.

14:22.900 --> 14:23.620
So I'm going to get.

14:23.620 --> 14:25.960
What's the content of this you are.

14:26.330 --> 14:31.350
And then I'm going to say returned J is equal to just an empty.

14:31.540 --> 14:38.570
So I'm just going to leave that as an empty dictionary for now that I'm going to say with open.

14:38.620 --> 14:46.300
So I'm going to open 10 that JP J Gates I'm going to just store a temporary image and then it's going

14:46.300 --> 14:52.340
to be W. B as F as efforts and then I'm going to do.

14:52.380 --> 14:53.570
F dot right.

14:53.600 --> 14:55.650
So I'm going to write it too.

14:56.050 --> 15:00.190
I want to write into f the content of R.

15:00.280 --> 15:07.750
OK so are has the image that I want then I'm going to open a new file called template that JP G.

15:07.870 --> 15:11.530
I'm going to write into the content of art which is the image itself.

15:11.560 --> 15:12.110
OK.

15:12.250 --> 15:18.000
So that's how simple it is to download an image in Python all right once I've done that then I'm going

15:18.000 --> 15:20.070
to do process is equal to.

15:20.070 --> 15:21.430
So I'm going to say process.

15:21.450 --> 15:27.860
I want to do a new process so I'm going to say some Prozess dot be open.

15:27.870 --> 15:38.040
So this is the syntax open and then Python classify underscore image Doppie y.

15:38.050 --> 15:39.730
So this is the file over here.

15:39.840 --> 15:47.220
So I'm going to open a new subprocess with this file Paice and classify underscore image not quite and

15:47.260 --> 15:52.430
that I'm going to pass the argument that the firewall.

15:52.470 --> 15:58.300
So the first one was models underscore or I think it was.

15:58.380 --> 15:59.220
Let's check.

15:59.220 --> 16:03.890
So it was modeled on your score directorates.

16:03.930 --> 16:08.200
No models it's a model underscore it or tree is equal to.

16:08.250 --> 16:14.680
And then I'm going to write dot because the font the the the the inception file as in this year this

16:14.680 --> 16:15.120
folder.

16:15.130 --> 16:27.190
So it's in the current folder and the image so the image file is in this folder and it's at dot slash

16:27.300 --> 16:29.580
10 and the GBG right.

16:29.590 --> 16:34.590
Because if you remember we downloaded the image and we store it in temporary GBG.

16:34.630 --> 16:39.590
So now what we have is the image file is stored in dot slash stamped GMP.

16:39.670 --> 16:40.300
OK.

16:41.730 --> 16:44.080
Now we're going to do.

16:44.080 --> 16:46.960
Process dot communicate.

16:47.210 --> 16:48.790
OK.

16:49.070 --> 16:50.200
Zero.

16:50.490 --> 16:51.900
And then we're going to process that.

16:51.930 --> 16:52.980
Wait.

16:53.490 --> 16:56.160
So we're going to wait until this process here is done.

16:56.180 --> 17:02.420
And this final and this subprocess writes the response Jason in a file.

17:02.430 --> 17:04.580
Let's say it's called text.

17:04.730 --> 17:05.670
Yes Steve.

17:05.790 --> 17:06.270
OK.

17:06.360 --> 17:07.680
So don't wait for it.

17:07.740 --> 17:12.630
And then now I want to get the of the the open the file that they have.

17:12.630 --> 17:13.110
OK.

17:13.190 --> 17:17.700
So I'm going to do with Open Text DXi.

17:17.760 --> 17:23.930
So what what writes this file is actually in this subprocesses over here that opens this file.

17:23.940 --> 17:27.660
So with open text that DST as.

17:27.810 --> 17:33.140
And then for example or let's say as G.

17:33.870 --> 17:41.000
And then we're going to do return J-Zone is equal to Jaison load and then G.

17:41.040 --> 17:41.510
OK.

17:41.550 --> 17:51.750
So I'm going to load the the the the dictionary that I stored into the the file text of the XTi And

17:51.750 --> 17:56.340
then finally once since I have the return adjacent here so I now have it.

17:56.340 --> 18:04.770
So once I exit out of all of this I'm just going to say Well first of all I want to return the return

18:04.770 --> 18:06.190
Jason to the user.

18:06.450 --> 18:11.180
But before I do this I need to take away one token from me because I used my service.

18:11.280 --> 18:22.890
So when I do users that update users update and then inside here we're going to do an user name and

18:22.890 --> 18:24.880
then it's going to be username.

18:24.960 --> 18:31.350
And what I'm going to update them with is I'm going to set his tokens to be one less than what he has

18:31.380 --> 18:33.980
and the new dollar set.

18:34.020 --> 18:38.380
And then hear him say tokens are going to be tokens.

18:38.400 --> 18:39.970
The variable minus one.

18:40.050 --> 18:42.020
So now he has one less pair.

18:42.030 --> 18:44.860
So you can see that we already got the tokens right.

18:44.910 --> 18:47.440
So he has one less token to worry about.

18:47.490 --> 18:48.760
OK.

18:49.030 --> 18:54.810
And now once we have done that we just returned to him the response which is generated by this file

18:54.810 --> 18:55.680
over here.

18:55.950 --> 19:02.910
Now let's go to this file and now we want to change this file to reflect what what this users actually

19:03.630 --> 19:04.860
is expecting right.

19:04.860 --> 19:10.940
So how do we write this returned Jason into the final text of the XTi.

19:11.070 --> 19:16.340
So we're going to go up here and then you can see here that there is a top Caze equal to predictions

19:16.360 --> 19:19.150
done on X or it slides a number addiction.

19:19.170 --> 19:19.600
OK.

19:19.800 --> 19:25.130
So after that I'm going to write return Jason is equal to an empty dictionary ok.

19:25.620 --> 19:34.690
Then inside this loop here I'm going to say return J-Zone human unstring is equal to a score.

19:34.710 --> 19:37.630
OK so for each you ministering I'm going to give it a score.

19:37.860 --> 19:38.670
All right.

19:40.000 --> 19:42.580
And then once I'm done with this process.

19:42.580 --> 19:49.960
So once I've generated this return Jason what I'm going to do is I'm going to store that or dump that

19:50.140 --> 19:51.560
into the text.

19:51.790 --> 19:52.530
64.

19:52.630 --> 20:05.310
So I'm going to do with Open Text dx d as F and then I'm going to do Jaison that dump and then return

20:05.310 --> 20:05.530
J.

20:05.530 --> 20:10.480
So I'm going to return this I'm going to dump this returned Jason and that I filled with that with the

20:10.480 --> 20:17.650
results and then I'm going to do Also a half into after the file text of DST and that's it.

20:17.650 --> 20:26.730
So we've just added a couple a few lines and then basically it is written into a file called texta DXi.

20:26.890 --> 20:33.390
Then from here what happens is after I run this command this command finishes so after post is dead.

20:33.400 --> 20:41.220
Wait what i do is I open the file text Dickstein that this file here has written and then I get visé

20:41.270 --> 20:41.740
Sunfire.

20:41.750 --> 20:49.250
So this way I've sent it there result from this classify image file into my file apt up yours.

20:49.330 --> 20:50.450
OK.

20:50.830 --> 20:56.950
So hopefully this made sense I wasn't and wasn't you know too difficult to understand.

20:56.950 --> 20:59.070
Now there's a couple of things that we need to do first.

20:59.110 --> 21:03.830
We have a couple of to do is right so there's a few functions that we haven't done.

21:03.910 --> 21:06.690
So the first one is to verify credentials.

21:06.700 --> 21:10.370
So why do you fine verify credentials.

21:10.390 --> 21:13.690
We have a username and password.

21:14.050 --> 21:14.790
OK.

21:17.940 --> 21:24.540
OK so how is the function going to look like someone to say first if not use or exists or it doesn't

21:24.540 --> 21:27.680
exist then what are we going to do.

21:27.720 --> 21:32.950
We're going to return generate return dictionaries.

21:32.990 --> 21:33.830
I'm going to.

21:33.990 --> 21:39.630
So I'm going to return this generate return dictionary and when I generate a new dictionary with the

21:39.630 --> 21:49.680
air feel one and the message invalid username username and then I'm also going to return true because

21:49.680 --> 21:51.940
remember this function returns two things.

21:52.020 --> 21:54.790
It returns a dictionary and true right.

21:54.810 --> 21:56.780
The air here is going to be true.

21:57.190 --> 22:02.290
OK next I'm also going to do the correct password correct.

22:02.380 --> 22:06.120
Underscore password is equal to verify.

22:07.010 --> 22:07.770
Password.

22:07.820 --> 22:13.910
So I'm gonna do a new function called the verify password that I'll give the user name user name and

22:13.910 --> 22:19.360
the password and he's going to tell me whether this user name matches the password or not.

22:19.530 --> 22:22.630
Then unless if not correct password.

22:22.790 --> 22:23.820
Then what do I do.

22:24.020 --> 22:25.450
Well I return.

22:25.730 --> 22:33.800
Generate return dictionary of 3 0 2 and then invalid password.

22:35.540 --> 22:38.120
And also true because there's an error here.

22:38.380 --> 22:39.100
OK.

22:39.380 --> 22:45.740
What is the password is correct and the user exists then that means that I there's no errors I return

22:45.830 --> 22:47.360
none and false.

22:47.480 --> 22:50.600
So zero errors and none came.

22:50.600 --> 22:53.360
The dictionary is just not great because we don't need it.

22:53.360 --> 22:54.780
There is no errors.

22:54.920 --> 22:55.610
Right.

22:55.880 --> 23:00.920
But then we've used here the generator your own dictionary and verify password so you need to write

23:00.920 --> 23:01.380
them.

23:01.600 --> 23:04.530
OK so the first one is the verify password.

23:04.580 --> 23:17.720
So you find verify password we take in a username and password and then if not user exist username then

23:17.720 --> 23:20.320
we're going to return false.

23:20.540 --> 23:26.000
Right because this this user name doesn't exist so the verify verifying the password failed.

23:26.990 --> 23:33.540
Also then we're going to hash get the hashed password so hashed password is equal to users not find.

23:33.800 --> 23:34.940
OK.

23:34.940 --> 23:39.410
And then inside the phone fine are you going to get their username the correct user.

23:39.680 --> 23:46.730
So user name user name and then for the hashed function I want to get the passwords I'm going to do

23:46.760 --> 23:48.740
zero and then password.

23:48.800 --> 23:49.040
Right.

23:49.040 --> 23:52.630
This is the hash password not the plain text.

23:53.060 --> 24:02.030
After I've done that I'm going to say if be script write the script that hash password and then password

24:02.120 --> 24:09.020
not encode UTF 8 UTF 8 bits 7.

24:09.020 --> 24:14.280
So UTF 8 with hash password.

24:14.320 --> 24:20.150
So this should be hashed password is equal to hash password.

24:20.530 --> 24:22.100
Then I'm going to return true.

24:22.300 --> 24:22.840
OK.

24:22.840 --> 24:28.520
So we're going to return true in this case because the passwords hash is matched match.

24:28.660 --> 24:30.420
Else I'm going to return false.

24:30.430 --> 24:31.960
So this is not correct.

24:32.040 --> 24:34.480
The Richards-Ross or it.

24:34.480 --> 24:40.860
So now we need another five to five on charities that generate return dictionary ok it's around right.

24:40.870 --> 24:45.040
Define return or generate return dictionary.

24:45.040 --> 24:54.630
So it's defined generate return dictionary and it's going to take a status and a message.

24:54.680 --> 24:55.100
Right.

24:55.330 --> 25:06.070
So I'm going to say return Jaison is equal to status is status and the message as the message right

25:07.410 --> 25:08.190
and the.

25:08.260 --> 25:13.000
And we just return this return return Jason and that's it.

25:13.000 --> 25:18.310
So we generate just using the status of the message we automatically in one line generate this Jason

25:18.310 --> 25:21.100
File here without having to waste a lot of lines.

25:22.090 --> 25:25.950
So that should be it for the classification.

25:25.960 --> 25:27.880
Right so we've done everything.

25:27.970 --> 25:34.330
And then finally we have the refill function which we'll do in the next video games are going to stop

25:34.330 --> 25:38.000
here and in the next video we're going to pick up from where we stop.

25:38.100 --> 25:38.620
OK.

25:38.800 --> 25:40.580
So until the next video recording.
