Skip to content

Example Classify Order#

To learn about the basics of creating an order, please refer to the quickstart guide.

Order description#

With this order we want to find out what kind of emotions certain AI generated image convey. We have asked Dalle-3 to generate 4 different images that would convey happiness, anger, disgust and sadness. Now we want to find out if the images are actually match the emotions we asked for.

'''
Classify order with a validation set
'''

from rapidata import RapidataClient


def get_emotions_of_images_order(rapi: RapidataClient):
    base_url = "https://assets.rapidata.ai/dalle-3_"
    emotions = ["anger", "disgust", "happiness", "sadness"]
    generated_images_urls = [f"{base_url}{emotion}.webp" for emotion in emotions]
    # Configure order
    order = (rapi.order_builder
             .classify_order("emotions from images")
             .question("What emotions do you feel when looking at the image?")
             .options(["happy", "sad", "angry", "surprised", "disgusted", "scared", "neutral"])
             .media(generated_images_urls)
             .responses(50)
             .submit()
            )

    return order


if __name__ == "__main__":
    order = get_emotions_of_images_order(RapidataClient())
    order.display_progress_bar()
    results = order.get_results()
    print(results)

The resulting rapids for the users look like this:

Classify Example