WEBVTT

00:00.440 --> 00:03.920
Okay, now we're going to put clown wigs on rhinos.

00:04.320 --> 00:04.480
Now.

00:04.520 --> 00:05.600
Whatever you want to do.

00:05.640 --> 00:09.680
We're using the flux context model to do image editing.

00:09.680 --> 00:12.760
So here's an image we already had of a rhino wearing a suit.

00:12.800 --> 00:16.600
And we just wanted to add a clown wig to his head.

00:16.640 --> 00:18.280
And it does a really good job.

00:18.360 --> 00:20.480
You can see that the quality is quite high.

00:20.640 --> 00:23.080
Like it doesn't change anything else about the scene.

00:23.320 --> 00:25.760
So that's what we're trying to accomplish.

00:25.840 --> 00:27.480
Now let's run through it together.

00:28.920 --> 00:31.840
First we need to install file I.

00:32.640 --> 00:34.800
And that's the library we're going to be using.

00:35.360 --> 00:37.840
We'll also have to get an API key for them.

00:38.440 --> 00:45.400
So if you don't have that already you just need to get that from file I dashboard keys.

00:45.400 --> 00:49.960
And then put that in your env file locally under the name file key.

00:51.200 --> 00:54.160
And then that code should just load that into memory.

00:54.160 --> 00:55.880
And it should work hopefully.

00:56.520 --> 00:56.840
All right.

00:56.880 --> 01:03.360
You need to import the file client and also these other libraries for handling the image.

01:03.760 --> 01:10.170
We're going to do this is like a pretty standard function for getting updates while file is processing.

01:10.170 --> 01:13.690
We also need to upload the Rhino image.

01:13.690 --> 01:19.610
So we've got this Rhino in a suit image that's just so we can get a URL online that we can we can pass

01:19.610 --> 01:20.290
into file.

01:20.330 --> 01:24.770
But if you already have the image saved online somewhere, you could just reference that URL.

01:25.090 --> 01:32.170
And we're using specifically under Flux Pro, there's context which is the this relatively new model

01:32.210 --> 01:41.530
here that will let you make changes to the image without making too many different changes to the rest

01:41.530 --> 01:46.850
of the image, other than the thing you're specifically asking it to do, and we're just going to pass

01:46.850 --> 01:48.610
in that on queue update function.

01:48.610 --> 01:53.490
So we get updates as we go, and we're going to run this and see how we do.

01:54.370 --> 01:56.890
So it's a really simple thing to do.

01:56.930 --> 02:01.250
Image editing previously would have been a lot harder, but it's much better now.

02:04.850 --> 02:07.330
Okay, we've got the image back.

02:07.330 --> 02:08.530
Let's see what it looks like.

02:09.450 --> 02:10.290
Yeah, here we go.

02:10.330 --> 02:10.970
It worked.

02:12.450 --> 02:19.810
So in order to show the image before and after, let's do say like before.

02:26.850 --> 02:28.330
Before transformation.

02:30.250 --> 02:33.810
And then we get the image URL.

02:33.930 --> 02:37.570
We'll download that image using the request library and display it.

02:37.570 --> 02:44.730
And then we'll say after transformation, what we actually want in the in here is like the original

02:44.730 --> 02:46.170
image actually.

02:46.170 --> 02:48.530
And then that's just going to display the original image.

02:50.210 --> 02:55.650
And then from that should give us that before and after.

03:04.970 --> 03:05.770
So on before.

03:05.810 --> 03:06.850
And that's on after.

03:07.290 --> 03:07.730
Cool.

03:08.130 --> 03:11.170
So yeah it's pretty pretty straightforward to use.

03:11.210 --> 03:14.450
You just pass in this model it can be relatively expensive.

03:14.450 --> 03:16.050
So just keep an eye on your credits.

03:16.050 --> 03:18.170
But other than that it works really well.
