How to use history prompts on the same image?

#12
by MotiHa - opened

Is it possible to ask several prompts on the same image in a loop with respect to the assistant answer? In the example the messages use different images for each message.

Yes it's totally possible (it was mostly trained this way during the SFT)

Could you give example?

HuggingFaceM4 org

It's exactly like the given snippet

messages = [
    {
        "role": "user",
        "content": [
            {"type": "image"},
            {"type": "text", "text": "What do we see in this image?"},
        ]
    },
    {
        "role": "assistant",
        "content": [
            {"type": "text", "text": "In this image, we can see the city of New York, and more specifically the Statue of Liberty."},
        ]
    },
    {
        "role": "user",
        "content": [
            {"type": "image"},
            {"type": "text", "text": "And how about this image?"},
        ]
    },       
]

but you can remove the extra {"type": "image"} where you don't want to put an image

Sign up or log in to comment