The workflow in this example is very simple and very similar to previous workflows. The idea is that we have a lot of images in our backlog, or that we just don't have time to categorize images in our editorial process. Let's automate it.
It takes advantage of OpenAI Vision to do the job.
It reads the image and then it can do actions for you based on your prompt, in this case a prompt specifically for the taxonomy field.
You end up with magic that takes the job away from you.
This video is from before the AI Interpolator module became AI Automators, part of the AI module . Module and menu names have changed since, and some steps look different today.
0:00
hey there uh Marcus here um I'm going to show you a workflow today that is um similar to something I did before so the the idea is basically to categorize content which is something we have done
0:14
before on text but what we're going to do now is categorize it on these nice images I just took some images as example so say that we have a car website um maybe we have a historical
0:28
car site that we already set up and there was something where we wanted to categorize the cars but it was just too much work for the editors and now it's just too much work because maybe
0:43
you're sitting on 10,000 20,000 images or something and you you know of course you could find a Mechanical Turk or uh maybe a student that's willing to help you but even that
0:56
would be a lot of work right so here comes AI to save the day um and this is basically what I'm going to show you how to set this up in Drupal today uh as usual this is just plain vanilla Drupal
1:12
uh I've only done two modifications to it I've added the admin toolbar uh so I can basically come to Pages a little bit faster I will also show you I have added
1:23
uh minimum stability Dev in the composer package that's because the AI Interpolator is still in beta there's no stable release yet but hopefully that's uh fixed
1:34
soon so this is the uh plugin we're going to use today which is the AI Interpolator OpenAI um together then with the AI Interpolator module which is a requirement for all these plugins
1:48
um before I start as usual Drupal is free AI Interpolator is free everything you see here you can do yourself after you have uh seen this tutorial it's going to be a little bit different uh so
2:01
I already show which kind of module to use right I didn't do that before uh which might have confused some people I will also show you how you actually install it I'm going to install it via
2:12
composer which is by far uh the most reliable method uh for doing it there are other ways you can do it but yeah that's how I'm going to do it so I just copied this composer
2:25
command I'm using something called Docksal for running this you could use DV or or Lando or even map or something you know set up Apache from scratch set up PHP from scratch nginx whatever you're
2:40
however you like to set it up but in this case I'm using dual which means I write fin it's just a wrapper command for for other commands to write uh run them inside the docker container then I
2:52
just paste this so this will get the AI Interpolator OpenAI but also the AI Interpolator in the OpenAI module because they are requirements basically connected to to this
3:05
module uh then what I will do is login I will go to extend and I will just find that module AI Interpolator OpenAI and I'm going to enable that but at the same time I'm
3:22
also going to enable the media module because in this case uh that makes sense if you want to set categories on images and make make it fieldable media is the best module for it in
3:35
Drupal um if you're not from the Drupal world there's so much documentation videos that where you can learn about the media modules or how Drupal Works in general you will see now uh you get a
3:49
error message here that you have to set up your open a account so I'm going to show you how to do this you do it under OpenAI settings this is not at all best practice this you should not be storing
4:01
it here because if you store it in a repo that gets sent to the repo and so on you should be using a n file and settings.php or something like that where it's basically maintained in a
4:13
deployment process but if you're just testing it out you can basically just paste it in here I'm I'm just going to drag this out a little bit uh because I don't want to show my key
4:27
basically uh save this this go to the homepage and voila we're back here we put it in here again so that's the first step second step is that I need to add a vocabulary
4:45
so that's basically my uh um my categories so I'm just going to steal here because I'm not I don't really know that much about cars to be honest uh convertible SUV so I'm just adding some
5:05
categories that it can choose from now uh crossover pay [Music] San pick up and hatchback I guess is enough that was what the a this one is a hashack and this one is a cabet I guess then I just
5:30
start adding some colors because I'm going to make this into a uh multi field basically so you can um it can choose many different categories as I as the idea right um and
5:47
so you can see also that it's truly working um so I'm just adding some colors and then I add two door or four door as well and if we just go here we can now see all
6:02
the different choices it has just let me see here this is blue and this is well it's silver I guess I wrote gray but yeah um wait let me remove that I guess in the car world you don't call it gray you
6:17
call it silver so it's just add gold see so it doesn't confuse that and then we have the media types where we need to add this field basically so there's the image uh media
6:34
type that we want to use for this we go to manage Fields just create a new field that is a tonomy that is this car tags we call it uh we say that it can be unlimited so because we wanted to check
6:50
many categories right and we choose the uh vocabulary card tags and then we just enable the AI Interpolator and there is this rule then called the OpenAI taxonomy so that's
7:02
the rule uh that can basically choose the categories for you automatically uh so here's a little bit funny in this case so you can install the token module so you can run the
7:15
Advan mode but I'm not going to show you that here so what you should do in this case is that you should just uh as a context field take a field that gets filled out which name will be
7:26
automatically uh and the reasoning for that is that's something has to be filled out for it to start the process but in this case the name doesn't really matter so we're setting a context that
7:37
doesn't matter right uh so what the context actually is going to be in this case is the image right and how to do this is that we go to advanced settings under the model we
7:49
choose GPT Vision preview because that's one of the modu models that actually has the possibility to read uh uh read an image and figure out something from it and when we do that you see this drops
8:02
up OpenAI Vision image and then you just choose the field that you actually want the image to be the context of right and this means uh in the prompt we can actually copy here because it's
8:16
almost correct So based on the instead of context text here will write image shoose up no shoose between 2 to four 2 to four categories from the category context that fits the text and
8:37
then category options you get from the context here so value options comma means that basically takes the list that we created before and gives it to uh to OpenAI as a comma separated
8:51
list and then just asks it right based on this list take two to four categories that fits uh this image and then we just remove this context because we don't have a text
9:06
context uh the weight can be 100 we can save it directly because we don't chain any AI in this case so we just save that um and then I will just go ahead here basically and take uh content add
9:27
media image oh this looks a little bit funny let's fix that first so we go to form display car tag should be here and we say that it should be a checkbox instead because that looks a little bit
9:47
nicer here so you can see if this was without AI what would happen is basically I would upload an image write the all text there is AI to write all text as well by the
10:03
way sorry um uh let's no just write audio Audi and then you would have to fill this out which is yeah it's not much work but of course if as I said if you have a
10:20
backlog of 20,000 images that you have already then it's not so fun so what we do instead we just leave it empty and then the interpolator understands oh I should kick in and try to do something
10:33
here so when we save this you're going to notice that it takes some time especially this is local so it doesn't need time to upload anything right uh and if you click edit now you see it has
10:46
filled in four door blue and a hatchback so it worked we're just going to try one more time add image and we try this uh A5 C same thing here we save it take some time because it needs to C
11:08
uh contact OpenAI of course and if we go to the cabola you see it's a twodo convertible silver I we just check here it is a twodo right and it show silver um and
11:27
that's it basically it's not more complex than that that's how you can set up automatic categorization on images uh using the AI Interpolator and the AI Interpolator OpenAI um yeah so thanks for watching and uh
11:45
Happy usage