I have read on.
Welcome back.
So in this final year we're going to be testing the API that we've been developing.
So a couple of things from the previous video.
Basically copied all the files in this file over here and I've moved them into the tutorial once since
we already finished it.
And the reason I did that is because this tutorial one file already has most of the libraries like flask
and stuff like that and flask trustful so we don't have to download them again from scratch but you
can do whatever I do right now and this similar similarity class file.
Right.
So you don't have to copy this into the tutorial one folder.
I just moved it so I don't have the internet connection isn't very good.
So I've just copied it there too.
So that docket composed can cache some of the previously downloaded libraries and instead of downloading
it again from scratch you can just access it from there.
OK so I'm gonna go to tutorial one.
But if you've been following so far then so.
So go back and then go to tutorial one.
And then if you've been following software you can pretend that you're inside text simulator and so
if you open here it is exactly the same file.
Everything's the same.
The ACT-UP why file is the same.
Right so this is what we've been writing registering detect and Riso.
So this API is exactly what you've been writing in the whole file structures to see.
So just pretend that you're indexing of it.
So the first thing we're going to do is to do Sunar Dharker compose built.
So we're going to build the project.
So you'll see that it is going to OK.
So I need to copy first of all this file because it's not excitatory or.
So that's the only thing I haven't copied it yet.
So I'm going to copy this file here that the model that we use in space.
And I'm going to do.
So let's first clear and then we're going to do Sudhakar composed build a gate is going to build them
all I was going to tell me successfully built the model and the next thing I'm going to do is to shoot
her dog her compose up and then I'm going to.
So it should be running now and then you'll see it's running on localhost.
So OK.
So let's now open post man again.
So we're going to open those men and in the meantime let's open the API to see how we expect the input
to be.
OK.
So we come here and I'm going to say pseudo atom here.
So I want to open the atom here.
OK.
So now it has been OK so this is active him over here.
This is our API.
It's at slash.
So let's close this here.
So this is our application.
So the first thing is for the registration right so we go at slash register and it's expecting a username
and password.
OK.
So I'm going to come to post Matt and then I'm going to write.
Let's go to body and lead that and then just go to local hosta 5:7 slash register.
And then from here let's say I have a Jaisalmer that I send a user name as a rule cause of my name and
password.
I'm going to write my password as 2:59 great.
Very very simple password.
And so I'm going to send this to so that I can register in the AP.
I'm going to send this.
And then there is the response status 202 I successfully signed up for the right for the message you
successfully signed up for the API.
Great.
So now I have registered for the API.
So now I'm going to be comparing.
So if I go to the second thing is detect right and detect expects a username password.
Text 1 and text 2.
OK.
So when I go back to postman and then I'm going to write karma.
So I have a user name and my password.
But this time I'm going to give it the next one.
As for example this is a cute dog.
OK.
And then free text do I'm going to write Wow what a cute dog.
OK.
So they're very similar right.
They're saying or for example I can write the dog is so cute.
OK.
So I'm saying one this is a cute dog.
And wow the dog is so cute and it's funny.
And that is going to tell me how close these two techs are or how similar they are.
So police should give us a relatively high number.
Right so not exactly one because there are different sentences obviously but they're also very similar.
Right.
They relate to each other.
OK so let's try to use the service or send text and it tells me it's an invalid username.
That's interesting.
OK I see.
So we haven't changed flash registers.
This should be slashed tact.
OK.
So not register.
So that's why it's telling me an invalid username because my user name is already taken.
So he tells me choose another one.
But we want to detect and not involve user ID and not register.
OK so we're going to send this again.
This is on file again.
And then your notice here that it tells me.
Let's see if I can make it bigger.
Not quite.
Exactly.
Postman you would notice here tells me similarity score calculator successfully ratio is 0.66 5.
So it's close to one race not super far away.
So you can think of it as this is sixty six point five percent.
Similar.
So these two sentences are sixty six point five percent similar and that's fair enough.
Right.
They're talking about the same thing but not necessarily in the same format right.
So this is the similarity between them and then status is still on.
So what about if we change for example you too.
Beautiful.
OK.
With that be changed the score obviously too good.
So now it's sixty two point two percent.
But you can still see that even though I changed it from cute to beautiful it still knows the similarity.
Right.
And this is the power of natural language processing.
Right.
It's able to do find that these two sentences are similar even though I don't.
So I only have this dog right dog here that is that are exactly the same.
But the sentences are two different sentences but it still finds the similarity is 62 percent.
And that's pretty pretty cool.
Right.
OK so what happens if I keep abusing the system right.
I use all my six tokens.
I want to keep sending requests keep sending requests keeps running until I run out of tokens.
So you can test the last gig.
Oh yeah.
So it says message you're out of tokens.
Please refill status three or three.
OK so that's the air.
Now I need to refill so I'm going on right refill and then username my username so let's let me just
copy this before I believe it.
So I'm going I write user name is Faruq admin password is ABC 1 2 3 right ABC 1 2 3.
And we're going to do the next one in-text do and we're gonna give it the refill amount.
So I'm going to write refill and then for example for someone to give myself were tokens OK.
So let's meet let's.
And that last refill sells refilled successfully status 200.
Now if I try to access the API again so I'm going to write the same to slash deduct the same Jason File
to detect and I said that then it tells me a similarity score calculator.
So now I have three tokens left.
Now I can actually change this and I can write for example.
Same sentence.
And then here I would write also same sentence.
And then it should be very very close to what rights are because they're exactly the same sentences.
So if I send them then you would notice here that the ratio is one.
Exactly.
So these sentences are exactly identical.
So yeah this is basically the entire API has three three ends or hit points register detect refill.
We've tested it and it works fine and everything's working cool.
So yeah we're going to stop here and I'll see you in the next video.
So until the next video the.