Image language
In [ ]:
Copied!
"""
This script demonstrates how to use the `run_on_language` method to run an experiment
with image stimuli.
"""
"""
This script demonstrates how to use the `run_on_language` method to run an experiment
with image stimuli.
"""
In [ ]:
Copied!
from sweetbean import Block, Experiment
from sweetbean.stimulus import Image
from sweetbean import Block, Experiment
from sweetbean.stimulus import Image
In [ ]:
Copied!
stim_1 = Image(
stimulus="https://media.istockphoto.com/id/120492078/photo/"
"banana.jpg?s=1024x1024&w=is&k=20&c=M9KLVNgqLft_btWgSu0iZAmdv2asI11Qel-6fsQK140=",
choices=[" "],
)
stim_1 = Image(
stimulus="https://media.istockphoto.com/id/120492078/photo/"
"banana.jpg?s=1024x1024&w=is&k=20&c=M9KLVNgqLft_btWgSu0iZAmdv2asI11Qel-6fsQK140=",
choices=[" "],
)
In [ ]:
Copied!
block = Block([stim_1])
experiment = Experiment([block])
block = Block([stim_1])
experiment = Experiment([block])
To make this work, there is a file called image_prompts.json in the same directory as this script with the following content: { "https://media.istockphoto.com/id/120492078/photo/banana.jpg?s=1024x1024&w=is&k=20&c=M9KLVNgqLft_btWgSu0iZAmdv2asI11Qel-6fsQK140=": "You see a picture of a banana." # noqa: E501 }
In [ ]:
Copied!
experiment.run_on_language()
experiment.run_on_language()