dipta007 commited on
Commit
ec4a322
1 Parent(s): 205c982
Files changed (10) hide show
  1. .gitignore +179 -0
  2. app.py +87 -0
  3. auth.py +29 -0
  4. gpt4V_analysis.py +153 -0
  5. gpt4V_analysis.txt +0 -0
  6. gpt4V_entity.py +76 -0
  7. gpt4V_entity.txt +208 -0
  8. requirements.txt +2 -0
  9. results.csv +0 -0
  10. results_with_gpt4v.csv +24 -0
.gitignore ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Created by https://www.toptal.com/developers/gitignore/api/python
2
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python
3
+
4
+ ### Python ###
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ # For a library or package, you might want to ignore these files since the code is
91
+ # intended to run in multiple environments; otherwise, check them in:
92
+ # .python-version
93
+
94
+ # pipenv
95
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
97
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
98
+ # install all needed dependencies.
99
+ #Pipfile.lock
100
+
101
+ # poetry
102
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
104
+ # commonly ignored for libraries.
105
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106
+ #poetry.lock
107
+
108
+ # pdm
109
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110
+ #pdm.lock
111
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112
+ # in version control.
113
+ # https://pdm.fming.dev/#use-with-ide
114
+ .pdm.toml
115
+
116
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117
+ __pypackages__/
118
+
119
+ # Celery stuff
120
+ celerybeat-schedule
121
+ celerybeat.pid
122
+
123
+ # SageMath parsed files
124
+ *.sage.py
125
+
126
+ # Environments
127
+ .env
128
+ .venv
129
+ env/
130
+ venv/
131
+ ENV/
132
+ env.bak/
133
+ venv.bak/
134
+
135
+ # Spyder project settings
136
+ .spyderproject
137
+ .spyproject
138
+
139
+ # Rope project settings
140
+ .ropeproject
141
+
142
+ # mkdocs documentation
143
+ /site
144
+
145
+ # mypy
146
+ .mypy_cache/
147
+ .dmypy.json
148
+ dmypy.json
149
+
150
+ # Pyre type checker
151
+ .pyre/
152
+
153
+ # pytype static type analyzer
154
+ .pytype/
155
+
156
+ # Cython debug symbols
157
+ cython_debug/
158
+
159
+ # PyCharm
160
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
163
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164
+ #.idea/
165
+
166
+ ### Python Patch ###
167
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
168
+ poetry.toml
169
+
170
+ # ruff
171
+ .ruff_cache/
172
+
173
+ # LSP config files
174
+ pyrightconfig.json
175
+
176
+ # End of https://www.toptal.com/developers/gitignore/api/python
177
+
178
+ .streamlit/
179
+ secrets_key.py
app.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import random
4
+ from auth import check_password
5
+
6
+ if not check_password():
7
+ st.stop()
8
+
9
+ st.set_page_config(
10
+ page_title="ARL - Pilot 2b - Agent 80 - GPT4V",
11
+ page_icon="🎆",
12
+ layout="wide",
13
+ )
14
+
15
+ df = pd.read_csv('./results_with_gpt4v.csv')
16
+ print(df.columns)
17
+
18
+
19
+ query = st.experimental_get_query_params()
20
+ if not query or 'id4' not in query or not query['id4']:
21
+ rnd_ind = random.randint(0, len(df) - 1)
22
+ # id = rnd_ind
23
+ id = 0
24
+ st.experimental_set_query_params(id=id)
25
+ file_id = id
26
+ else:
27
+ file_id = int(query['id4'][0])
28
+
29
+
30
+ st.experimental_set_query_params(id4=file_id)
31
+
32
+ data = df.iloc[file_id]
33
+ # st.table(data)
34
+ # print(data)
35
+
36
+ def show_story():
37
+ st.subheader('Impacted Story')
38
+ number_of_story_lines = int(data['Input.number_of_lines'])
39
+ print(number_of_story_lines)
40
+ story = data['Input.story'].split('. ')
41
+ for i in range(number_of_story_lines):
42
+ row_name = f'Answer.line{i}_changed.on'
43
+ print(row_name, data[row_name])
44
+ if data[row_name]:
45
+ st.markdown(f'**Line {i+1}:** <mark style="background-color: white">{story[i]}</mark>', unsafe_allow_html=True)
46
+ else:
47
+ st.markdown(f'**Line {i+1}:** {story[i]}')
48
+
49
+
50
+ def show_data():
51
+ col1, col2 = st.columns(2)
52
+
53
+ with col1:
54
+ img1, img2, img3 = st.columns(3)
55
+ with img1:
56
+ st.image(data['Input.image1'])
57
+ with img2:
58
+ st.image(data['Input.image2'])
59
+ with img3:
60
+ st.image(data['Input.image3'])
61
+
62
+ st.subheader('Entity')
63
+ st.write(data['Input.entity'])
64
+ st.subheader('Agent')
65
+ st.write(data['Input.agent'])
66
+ # st.subheader('Input Goal')
67
+ # st.write(data['Input.goal'])
68
+ st.subheader('Story')
69
+ st.write(data['Input.story'])
70
+
71
+ with col2:
72
+ st.header('GPT4V Output')
73
+ st.markdown(data['GPT4V.out'], unsafe_allow_html=True)
74
+
75
+ # from api import show_likert_scale
76
+ # done = show_likert_scale('step_all', 'Whole', data['AssignmentId'])
77
+
78
+ done = True
79
+ if st.button("Next", disabled=not done):
80
+ id = file_id + 1
81
+ st.experimental_set_query_params(id4=id)
82
+ st.experimental_rerun()
83
+
84
+
85
+
86
+
87
+ show_data()
auth.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def check_password():
4
+ """Returns `True` if the user had the correct password."""
5
+
6
+ def password_entered():
7
+ """Checks whether a password entered by the user is correct."""
8
+ if st.session_state["password"] in st.secrets["passwords"]:
9
+ st.session_state['user'] = st.session_state["password"]
10
+ st.session_state["password_correct"] = True
11
+ else:
12
+ st.session_state["password_correct"] = False
13
+
14
+ if "password_correct" not in st.session_state:
15
+ # First run, show input for password.
16
+ st.text_input(
17
+ "Password", type="password", on_change=password_entered, key="password"
18
+ )
19
+ return False
20
+ elif not st.session_state["password_correct"]:
21
+ # Password not correct, show input + error.
22
+ st.text_input(
23
+ "Password", type="password", on_change=password_entered, key="password"
24
+ )
25
+ st.error("😕 Password incorrect")
26
+ return False
27
+ else:
28
+ # Password correct.
29
+ return True
gpt4V_analysis.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from secrets_key import OPENAI_KEY, RANDOM_SEED
2
+ from openai import OpenAI
3
+ import json
4
+ import pandas as pd
5
+ from pprint import pprint
6
+
7
+
8
+ client = OpenAI(api_key=OPENAI_KEY)
9
+
10
+
11
+ ti_prompt = """
12
+ In the following HIT, you will be presented with a collection of images and a story that is, in some manner, related to that goal. You are also given a specific agent and an entity (generally, person or object).
13
+ 1. Identify a goal that the agent in the story is trying to achieve.
14
+ 2. Identify and write a condition that is necessary for goal completion. The condition should be related to the entity.
15
+ 3. Write an alternate condition that will make the goal unlikely to happen. It is likely that this alternate condition will contradict information provided in the images and/or story.
16
+
17
+ Make each response minimum 5 words long and maximum 25 words long.
18
+
19
+ Story: {story}
20
+
21
+ Agent: {agent}
22
+ Entity: {entity}
23
+ """
24
+
25
+ t_prompt = """
26
+ In the following HIT, you will be presented with a story. You are also given a specific agent and an entity (generally, person or object).
27
+ 1. Identify a goal that the agent in the story is trying to achieve.
28
+ 2. Identify and write a condition that is necessary for goal completion. The condition should be related to the entity.
29
+ 3. Write an alternate condition that will make the goal unlikely to happen. It is likely that this alternate condition will contradict information provided in the story.
30
+
31
+ Story: {story}
32
+
33
+ Agent: {agent}
34
+ Entity: {entity}
35
+ """
36
+
37
+ i_prompt = """
38
+ In the following HIT, you will be presented with a collection of images of a story. You are also given a specific agent and an entity (generally, person or object).
39
+ 1. Identify a goal that the agent in the story is trying to achieve.
40
+ 2. Identify and write a condition that is necessary for goal completion. The condition should be related to the entity.
41
+ 3. Write an alternate condition that will make the goal unlikely to happen. It is likely that this alternate condition will contradict information provided in the images.
42
+
43
+ Agent: {agent}
44
+ Entity: {entity}
45
+ """
46
+
47
+
48
+
49
+ def analysis(story, agent, entity, images, text=True, image=True):
50
+ if text and image:
51
+ now_prompt = ti_prompt.format(story=story, agent=agent, entity=entity)
52
+ elif text:
53
+ now_prompt = t_prompt.format(story=story, agent=agent, entity=entity)
54
+ elif image:
55
+ now_prompt = i_prompt.format(agent=agent, entity=entity)
56
+ else:
57
+ raise ValueError("text and image cannot both be False")
58
+
59
+ content = [
60
+ {"type": "text", "text": now_prompt},
61
+ ]
62
+ if image:
63
+ content.extend([{"type": "image_url", "image_url": image} for image in images])
64
+
65
+ response = client.chat.completions.create(
66
+ model="gpt-4-vision-preview",
67
+ seed=RANDOM_SEED,
68
+ messages=[
69
+ {
70
+ "role": "user",
71
+ "content": content
72
+ }
73
+ ],
74
+ temperature=1,
75
+ max_tokens=256,
76
+ top_p=1,
77
+ frequency_penalty=0,
78
+ presence_penalty=0,
79
+ )
80
+ out = response.choices[0].message.content
81
+ print("OUTPUT:", out)
82
+ print()
83
+
84
+ return out
85
+
86
+ if __name__ == '__main__':
87
+ df = pd.read_csv('./results.csv')
88
+ df = df.sample(frac=1, random_state=42).reset_index(drop=True)
89
+ count = 0
90
+ done = set()
91
+ data = []
92
+ for ind, row in df.iterrows():
93
+ item_id = row['Input.item_id']
94
+ if item_id in done:
95
+ continue
96
+ done.add(item_id)
97
+
98
+ try:
99
+ story = row['Input.story']
100
+ agent = row['Input.agent']
101
+ entity = row['Input.entity']
102
+ images = [row[f'Input.image{i}'] for i in range(1,4)]
103
+
104
+ print("HITId:", row['HITId'])
105
+ print("Prompt:", ti_prompt.format(story=story, agent=agent, entity=entity))
106
+ print()
107
+ print("Image1:", images[0])
108
+ print("Image2:", images[1])
109
+ print("Image3:", images[2])
110
+ print()
111
+
112
+ gpt4v_out = ""
113
+ for text in [True, False]:
114
+ for image in [True, False]:
115
+ if text or image:
116
+ print("Text Visible:", text)
117
+ print("Image Visible:", image)
118
+ out = analysis(story, agent, entity, images, text=text, image=image)
119
+
120
+ # gpt4v_out += f"#### Text Visible: {text}\n"
121
+ # gpt4v_out += f"#### Image Visible: {image}\n"
122
+
123
+ if text and image:
124
+ gpt4v_out += f"### Both text and image are visible.\n"
125
+ elif text:
126
+ gpt4v_out += f"### Only text is visible.\n"
127
+ elif image:
128
+ gpt4v_out += f"### Only image is visible.\n"
129
+
130
+ gpt4v_out += f"#### Output: \n"
131
+ gpt4v_out += out
132
+ gpt4v_out += "\n"
133
+
134
+ obj = row.to_dict()
135
+ obj['GPT4V.out'] = gpt4v_out
136
+
137
+ data.append(obj)
138
+
139
+ print("====================================")
140
+ print()
141
+
142
+ count += 1
143
+ except Exception as e:
144
+ done.remove(item_id)
145
+ print("ERROR:", e)
146
+ print("====================================")
147
+ print()
148
+
149
+ if count == 1:
150
+ break
151
+
152
+ df = pd.DataFrame(data)
153
+ df.to_csv('./results_with_gpt4v.csv', index=False)
gpt4V_analysis.txt ADDED
File without changes
gpt4V_entity.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from secrets_key import OPENAI_KEY, RANDOM_SEED
2
+ from openai import OpenAI
3
+ import json
4
+ import pandas as pd
5
+ from pprint import pprint
6
+
7
+
8
+ client = OpenAI(api_key=OPENAI_KEY)
9
+
10
+
11
+ prompt = """
12
+
13
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
14
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
15
+
16
+
17
+ Story: {story}
18
+ """
19
+
20
+
21
+ def get_entity_gpt4V(row):
22
+ story = row['Input.story']
23
+ now_prompt = prompt.format(story=story)
24
+ content = [
25
+ {"type": "text", "text": now_prompt},
26
+ ]
27
+ images = []
28
+ for i in range(1,4):
29
+ image_url = row[f'Input.image{i}']
30
+ images.append(image_url)
31
+ content.append({
32
+ "type": "image_url",
33
+ "image_url": {
34
+ "url": image_url,
35
+ },
36
+ })
37
+
38
+ response = client.chat.completions.create(
39
+ model="gpt-4-vision-preview",
40
+ seed=RANDOM_SEED,
41
+ messages=[
42
+ {
43
+ "role": "user",
44
+ "content": content
45
+ }
46
+ ],
47
+ temperature=1,
48
+ max_tokens=256,
49
+ top_p=1,
50
+ frequency_penalty=0,
51
+ presence_penalty=0,
52
+ )
53
+
54
+ print(row['HITId'])
55
+ print(now_prompt)
56
+ pprint(images)
57
+ out = response.choices[0].message.content
58
+ print("OUTPUT:", out)
59
+ print("====================================")
60
+ print()
61
+
62
+ if __name__ == '__main__':
63
+ df = pd.read_csv('./results.csv')
64
+
65
+ count = 0
66
+ done = set()
67
+ for ind, row in df.iterrows():
68
+ item_id = row['Input.item_id']
69
+ if item_id in done:
70
+ continue
71
+ done.add(item_id)
72
+ get_entity_gpt4V(row)
73
+ count += 1
74
+
75
+ if count == 10:
76
+ break
gpt4V_entity.txt ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 36MUZ9VAE8MI4ZXG5C562HJOH58ED2
2
+
3
+
4
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
5
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
6
+
7
+
8
+ Story: The parade is starting and people line the streets. The folks who live upstairs in the buildings get a good view. The really cool floats are coming next. It's raining harder but no one seems to mind. The people came prepared with umbrellas for this special occasion.The more the parade goes on, the better the displays seem to be. The zoo animals are very well done and everybody is standing in the rain to see them. The man's dog is a bit confused by these animals. Everyone is having a good time watching the parade and chatting with their neighbors.
9
+
10
+ ['https://drive.google.com/uc?export=view&id=1LhLpWAkuIIVDf5jl1E7_DppoHQwl-7P9',
11
+ 'https://drive.google.com/uc?export=view&id=11r_tEEa7QcEkalT_wcZOtOxnaztqtETh',
12
+ 'https://drive.google.com/uc?export=view&id=1NsZpx_otGbh9Jz00A9eyF3xoUfTnvNxH']
13
+ OUTPUT: ```python
14
+ [
15
+ {'image_number': 1, 'person/object': 'building with a sign "Buck's 5th Avenue"'},
16
+ {'image_number': 2, 'person/object': 'white dog'},
17
+ {'image_number': 3, 'person/object': 'person in blue with umbrella'}
18
+ ]
19
+ ```
20
+ ====================================
21
+
22
+ 3P0I4CQYV0R3PWAWGLDSZH2NSNJWOW
23
+
24
+
25
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
26
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
27
+
28
+
29
+ Story: The townsfolk are gathered for a parade. There are many families with children. This is a special day. Everyone is here for the celebration. It has been raining, so many people brought their umbrellas and rain caps. The parade is downtown, so people who live in apartments there can just open their windows and watch from home.The floats are comprised of different animals. Everyone is having a great time.This is a special day and everyone has been looking forward to viewing all the different animal floats people made for the parade.Families are gathered together, along with friends. It turns out the parade happens on a rainy day, so everyone brought their rain gear. The rain doesn't dampen the mood though, and everyone has a great time.There are people dressed up like flamingos, a rhinoceros float and a zebra float, along with many other festive floats.
30
+
31
+ ['https://drive.google.com/uc?export=view&id=1IzZcjV22ftn_wK9Ug7zihsCB_KKnsc8k',
32
+ 'https://drive.google.com/uc?export=view&id=1RDdlOJP5udN_uSlamKEF9qnEC_aWw5yI',
33
+ 'https://drive.google.com/uc?export=view&id=1DzEy5rzApDKpFdMbblkDJcQ1c1abU-WE']
34
+ OUTPUT: ```python
35
+ [
36
+ {'image_number': 1, 'person/object': 'building'},
37
+ {'image_number': 2, 'person/object': 'dog'},
38
+ {'image_number': 3, 'person/object': 'camera'}
39
+ ]
40
+ ```
41
+ ====================================
42
+
43
+ 3RBI0I35XGNISCCACOBOWBPS84O3Y8
44
+
45
+
46
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
47
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
48
+
49
+
50
+ Story: This was the perfect place for a meeting. Jack had made contact with his asset the night before and was ready for the next step on the plan. The large crowd paired with the rain made for the perfect cover. The go signal for the drop was when the rhino float went by the middle of the street.Scanning the crowd, Jack finally saw his asset. He was low to the ground, wearing a red raincoat. `Could you be anymore conspicuous?` Jack said to himself. Just then the rhino float went by and Jack's asset darted across the street. Jack felt the envelope leave his hand and a wet nose graze his thumb. By the time Jack looked back up his asset was across the street again, watching the zebra float go by.
51
+
52
+ ['https://drive.google.com/uc?export=view&id=1SeI0CQU_jMNTGvu5E5GfT-4Sh4jMOILA',
53
+ 'https://drive.google.com/uc?export=view&id=1JDv6-QjI-alRhd2e5yv6ZaUgs7dE-k-N',
54
+ 'https://drive.google.com/uc?export=view&id=1G2-19uq96Y2NB12l6QpsCelVY7KQFiJ6']
55
+ OUTPUT: ```python
56
+ [
57
+ {'image_number': 1, 'person/object': 'person in a blue dress'},
58
+ {'image_number': 2, 'person/object': 'person with a white dog'},
59
+ {'image_number': 3, 'person/object': 'person in a yellow jacket'}
60
+ ]
61
+ ```
62
+ ====================================
63
+
64
+ 311HQEI8RU00YLN2AMGXNZAAJ0DZ7Z
65
+
66
+
67
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
68
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
69
+
70
+
71
+ Story: One gloomy cool day, Jack, his dad and grandfather all decided to go on a hike on the mountain nearby their town. They started on a trail that leads up to the mountain. The trail was covered with leaves that had fallen from the surrounding trees. They were so dry and brittle the sound of them crunching under their shoes sounded like breaking bones. They had their backpacks ready with any necessities they thought would be somewhat needed up the mountain and their time there. They packed it with some first aid kits, drinks, snacks, and other things. At one point they had to go through what's now an old tunnel in the middle of the woods. That part was always Jacks favorites because they would always stop and mark their names on the walls of the old tunnel.As they continued to walk through the trail, they came upon a very old part of a bridge. Jack was the first one to arrive in front of it, his father and grandfather walked slowly behind him. They stopped and admired the old structure, walls filled with stones, the details amazed them. There was a tunnel going under the bridge which they would have to go under to continue their path and get to their destination. Once they were done admiring the old structure they continued their way that led to their final destination and went ahead and started their hike for that afternoon. The trail on the way to the mountain was always an important and admiring part of the hike, Jack could even say it was his favorite part!
72
+
73
+ ['https://drive.google.com/uc?export=view&id=1rERt9XDOv1HvXTgePqUq99QqXlwuQ5BL',
74
+ 'https://drive.google.com/uc?export=view&id=1v0VtbVKuHkkqIljVOCVd2_EtJkIw1zp9',
75
+ 'https://drive.google.com/uc?export=view&id=15PzKneScAIvHKukEfF_lC9NhJav49UFb']
76
+ OUTPUT: ```python
77
+ [
78
+ {'image_number': 1, 'person/object': 'stone arch'},
79
+ {'image_number': 2, 'person/object': 'leaf-covered ground'},
80
+ {'image_number': 3, 'person/object': 'person in foreground'}
81
+ ]
82
+ ```
83
+ ====================================
84
+
85
+ 3S4TINXCC27B1TCLLUHWC3P2IM2BOW
86
+
87
+
88
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
89
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
90
+
91
+
92
+ Story: A family on vacation sees a sign for Wing Cave National Park and decides to check it out. After parking their vehicle, they begin walking through the park, and see a sign which gives a full name of the national park. The first thing they see is a beautiful field with dozens of green trees in the distance.As the family continues to walk through the national park, they begin to realize there is not many animals. On top of that all of the grass and shrubs have died off. While they are walking, they recognize a distressed deer looking for grass. The family watches the deer for a few minutes, to see if they finally find grass to munch on. As far as they were able to see, the deer never found grass. The family realized how dire the situation was at that national park for the animals in it, and decided to call the park ranger before continuing their vacation.
93
+
94
+ ['https://drive.google.com/uc?export=view&id=1l5wkpwaM5kg3tpZE1rWOpfhKJtpzaQaR',
95
+ 'https://drive.google.com/uc?export=view&id=1Tj8p07jP9V-FFI1-m6FjS7NoQ7xUEmfr',
96
+ 'https://drive.google.com/uc?export=view&id=1l9FGUGIcpOOP87jtVgOGgSZGKB4-9qsi']
97
+ OUTPUT: ```python
98
+ [
99
+ {'image_number': 1, 'person/object': 'park entrance sign'},
100
+ {'image_number': 2, 'person/object': 'dry grass'},
101
+ {'image_number': 3, 'person/object': 'distressed deer'}
102
+ ]
103
+ ```
104
+ ====================================
105
+
106
+ 3X2YVV51PWOIT43VAJFHNLPFZCA1WF
107
+
108
+
109
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
110
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
111
+
112
+
113
+ Story: We visited a new National Park every year. It was tradition, my favorite tradition. Mom loved Yellowstone. Dad loved the Everglades. I hated it all. But since the divorce, I've been craving these trips more than anything I can remember. Together as a family, that's what these trips did for us. This year Mom and Dad agreed to come together, to be civil around each other. We went to Wind Cave National Park, who had ever heard of that? The first day on the drive in we went through the entrance and immediately saw a buffalo, all on its own.We got to our camping site and unloaded. Things were going well so far, no fighting. This could maybe be ok? First activity of the day was a day hike to Wind Cave. It's cool outside. The sun begins to go down. We see a deer on its own, grazing. This is not the same.
114
+
115
+ ['https://drive.google.com/uc?export=view&id=1I6Js6YB4EjVYooRni1gc-1qO79sBV8X2',
116
+ 'https://drive.google.com/uc?export=view&id=1OPdP6gue8TFu3V-kFhMQ1mb6RonOcfFt',
117
+ 'https://drive.google.com/uc?export=view&id=1JqIkEbPtsIXrhMLfkR9-R6lUQgs9l9q4']
118
+ OUTPUT: ```python
119
+ [
120
+ {'image_number': 1, 'person/object': 'entrance sign'},
121
+ {'image_number': 2, 'person/object': 'trees'},
122
+ {'image_number': 3, 'person/object': 'grass'}
123
+ ]
124
+ ```
125
+ ====================================
126
+
127
+ 39WICJI5AVCIX2MF8AD7AIYUEYS3ZZ
128
+
129
+
130
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
131
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
132
+
133
+
134
+ Story: While reading their kids books at the children's table at the local library, Jane and Timmy are being very good. Their mother told them to sit and read while she goes to the adult section to get some books for her. They sat quietly and read for a few minutes. Then they got up and snuck around all of the book shelves. They were curious as to where the mother had disappeared to. Instead of sitting and reading, Jane and Timmy decide to go on an excursion to see if they could find their mother, while exploring the rest of the library.Jane and Timmy search for a bit and found themselves having a little bit too much fun. They decide to play tag right inside the library. They run back and forth and in and out of the aisles. Suddenly they are stopped in their tracks by a security man. He asked them who they were, where was their mother, and why they were running around the library and being so noisy. Jane and Timmy were scared. They were just having fun. The security guard them took them to the circulation desk so they could sit while he found their mother.
135
+
136
+ ['https://drive.google.com/uc?export=view&id=1qWrBBA2qxofeP5dOHhro1agUGgarJXk_',
137
+ 'https://drive.google.com/uc?export=view&id=1QlT-AWLSiMz0vB1FPper-2NncvQ8dhEu',
138
+ 'https://drive.google.com/uc?export=view&id=1wqGZzMN0WxEW6b769kfNdzlARg6EQPB8']
139
+ OUTPUT: [
140
+ {"image_number": 1, "person/object": "children's chair"},
141
+ {"image_number": 2, "person/object": "patterned armchair"},
142
+ {"image_number": 3, "person/object": "circulation desk"}
143
+ ]
144
+ ====================================
145
+
146
+ 3QXFBUZ4ZM025F4TX2LJCK8OGLHUG8
147
+
148
+
149
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
150
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
151
+
152
+
153
+ Story: Janice and Joseph are in the golden years of their lives. They're on vacation in the mountains. They rented a secluded cabin so that they could enjoy each others company without any distractions. Today, they decided to trek into town and check out the historic steam engine. It's well known around these parts. The conductor has oodles of stories to share with anyone that cares enough to ask.Janice and Joseph take a walk up to the actual train depot and board a bigger train to go on a tour. The tour takes a couple hours and weaves through the magical mountain forest. As they're riding, they can't help but be smitten by the beautiful scenery passing them by. Some young children are dangling their entire bodies out the window of the train, though. This is giving Joseph anxiety and he badly wants to say something to them. However, he abstains in the interest of not causing a scene in front of the love of his life.
154
+
155
+ ['https://drive.google.com/uc?export=view&id=1J3MHdFt5UzFraZ_pB8NzRkbtxoGkse3X',
156
+ 'https://drive.google.com/uc?export=view&id=1rO8oTfkvz_QRK-EgGgIt_940dB5Q3uti',
157
+ 'https://drive.google.com/uc?export=view&id=1KcjSxEzOnuuL1P7OL0GgTQfY8nQKliRG']
158
+ OUTPUT: ```python
159
+ [
160
+ {'image_number': 1, 'person/object': 'green foliage'},
161
+ {'image_number': 2, 'person/object': 'conductor'},
162
+ {'image_number': 3, 'person/object': 'grass field'}
163
+ ]
164
+ ```
165
+ ====================================
166
+
167
+ 3H6W48L9F69LAWMXVLQ7OH7D2SFWPD
168
+
169
+
170
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
171
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
172
+
173
+
174
+ Story: There is a place in the world where the most people go to in their holidays they visit the biggest desert where people gets into helicopter and sees the enormous land from above and the warm air they you feel and there are other people who just like to travel by travel by walking with your family and friends.There is a ancient history with that log old cowboys of the western side used to camp there and have fum stories with their family and friends but one day a disaster happened which caused the log get red and rotten and from all over there world tourist goes to that wonderful place.
175
+
176
+ ['https://drive.google.com/uc?export=view&id=1DyIOAuMsSy1flFmvB255cT5F3ScI2qfd',
177
+ 'https://drive.google.com/uc?export=view&id=1rn7_WOGfwMoUurHog8DQV5GEIA0kugGB',
178
+ 'https://drive.google.com/uc?export=view&id=112TxpwMDA34EO0Rrleh7XnBG56YN0vHt']
179
+ OUTPUT: ```python
180
+ [
181
+ {'image_number': 1, 'person/object': 'dirt road'},
182
+ {'image_number': 2, 'person/object': 'wooden fence'},
183
+ {'image_number': 3, 'person/object': 'piece of wood'}
184
+ ]
185
+ ```
186
+ ====================================
187
+
188
+ 3R4QIDVOJRWNW5BG17GQ8Z19HH9EEV
189
+
190
+
191
+ You are given a story and 3 images related to the story. Identify a person/object that can be visually identified in the images but not directly mentioned on the story. Use as few words as possible to describe each person/object. Also, mention the image number (1, 2 or 3) where the person/object can be found.
192
+ Output in a python list of dictionaries. Each dictionary should have the following keys: 'image_number', 'person/object'.
193
+
194
+
195
+ Story: The American Indian Sioux tribe ran off all white settlers in a certain region of Arizona for decades, and returned to the traditional native way of life free from interference of the white man. The Sioux headed down into the Red Valley earlier this year to look for more wild American buffalo, and began to venture further out into their territory. As they travelled further on horseback they saw something in the distance. A giant picnic table, sitting under a pavilion to the East. The tribe snuck closer to investigate, and what they saw shocked them. Dozens of white people marching like zombies toward the massive relic.The Sioux were shocked and confused. They continued to come closer, and followed the white travelers from a distance. All the travelers seemed to stop at a certain location miles before the monument. They would stop for a few minutes, looking down, then continue. The Sioux waited until it had cleared out and came up to where this happened, looked down and saw a rusty red rock in a tuft of grass. The Sioux were puzzled, scared, and concerned. They decided to go home and worry about themselves.
196
+
197
+ ['https://drive.google.com/uc?export=view&id=1VD1OaSBpYpbDvslubnKPyGmzl7WviMaY',
198
+ 'https://drive.google.com/uc?export=view&id=1-yaC9PVnIW-xJjV6STfJguK_zDs6QcWW',
199
+ 'https://drive.google.com/uc?export=view&id=1KN13XPAEPynxzrk60GI-R-Pgrz4sp2jb']
200
+ OUTPUT: ```python
201
+ [
202
+ {'image_number': 1, 'person/object': 'winding dirt road'},
203
+ {'image_number': 2, 'person/object': 'wooden fence'},
204
+ {'image_number': 3, 'person/object': 'petrified wood'}
205
+ ]
206
+ ```
207
+ ====================================
208
+
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ google-cloud-firestore
2
+ path
results.csv ADDED
The diff for this file is too large to render. See raw diff
 
results_with_gpt4v.csv ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ HITId,HITTypeId,Title,Description,Keywords,Reward,CreationTime,MaxAssignments,RequesterAnnotation,AssignmentDurationInSeconds,AutoApprovalDelayInSeconds,Expiration,NumberOfSimilarHITs,LifetimeInSeconds,AssignmentId,WorkerId,AssignmentStatus,AcceptTime,SubmitTime,AutoApprovalTime,ApprovalTime,RejectionTime,RequesterFeedback,WorkTimeInSeconds,LifetimeApprovalRate,Last30DaysApprovalRate,Last7DaysApprovalRate,Input.item_id,Input.id,Input.image_set,Input.entity,Input.agent,Input.image1,Input.image2,Input.image3,Input.story,Input.number_of_lines,Answer.agent_makes_no_sense.on,Answer.agent_makes_no_sense_text,Answer.condition,Answer.goal,Answer.line0_changed.on,Answer.line10_changed.on,Answer.line11_changed.on,Answer.line12_changed.on,Answer.line13_changed.on,Answer.line14_changed.on,Answer.line15_changed.on,Answer.line16_changed.on,Answer.line17_changed.on,Answer.line18_changed.on,Answer.line19_changed.on,Answer.line1_changed.on,Answer.line20_changed.on,Answer.line21_changed.on,Answer.line22_changed.on,Answer.line23_changed.on,Answer.line24_changed.on,Answer.line2_changed.on,Answer.line3_changed.on,Answer.line4_changed.on,Answer.line5_changed.on,Answer.line6_changed.on,Answer.line7_changed.on,Answer.line8_changed.on,Answer.line9_changed.on,Answer.not_condition,Answer.not_condition_ep,Answer.rating.1,Answer.rating.2,Answer.rating.3,Answer.rating.4,Answer.rating.5,Answer.story_impact.no,Answer.story_impact.yes,Answer.why_no_impact,Approve,Reject,GPT4V.out
2
+ 35JDMRECC6TLGJ77726E82MLUXOEGC,38JF4YFDOM8MELZ3H6MMOC0A1QZ96M,Understanding how changing an attribute of an agent affects the visual story,Help us to generate alternate story,"story, multimodal, counterfactual",$0.45,Tue Nov 14 14:25:40 PST 2023,1,BatchId:5156379;OriginalHitTemplateId:920937340;,3600,1209600,Tue Nov 21 14:25:40 PST 2023,,,3JWH6J9I9VXW6RA3AHMLLYLPLR3BN0,A3B84NGQT7Z9WE,Submitted,Wed Nov 15 08:38:23 PST 2023,Wed Nov 15 08:48:47 PST 2023,Wed Nov 29 08:48:47 PST 2023,,,,624,100% (1401/1401),0% (0/0),0% (0/0),98,57,Flickr 10,A few scattered spectators,Surgeon,https://drive.google.com/uc?export=view&id=1dx4FK7tJ15MHcKC9vwhEmznxFHwSZSdb,https://drive.google.com/uc?export=view&id=1zkiU8D4VfGq5KrvzVOTAQbMBajnCJAMP,https://drive.google.com/uc?export=view&id=1vmL9PnIVrm37C4cRgrrS0h9OKOVZI3rG,"The three friends loved the soccer fields. Even when there wasn't a game, they would sit on the bleachers and reminisce about games gone by. Raquel couldn't play ever since his knee injury and he missed running up and down the field and being part of the team. He could imagine the games in his mind, projecting them onto the empty field.He had dreamed of making it out of the small municipal field and into the big leagues. To play in the World Cup was a dream he could taste. That was before another player plowed into him. Some say they planned it to take him out for the season. They ended up taking him out of the game for good. The surgeon wasn't able to fully repair the knee. He'd never be the same.",10,False,,"After Raquel's injury, a few of his friends helped him with his rehabilitation exercises.",To restore Raquel's knee back to its original condition.,False,,,,,,,,,,,False,,,,,,True,False,False,False,False,False,True,True,Raquel reinjures his knee during recovery which worsens the condition.,"The friends are not able to be at Raquel's side 24x7, and thus he sustains further injury when they are not around.",False,False,False,True,False,False,True,,,,"### Both text and image are visible.
3
+ #### Output:
4
+ 1. Goal: Successfully repair Raquel's knee injury.
5
+ 2. Necessary condition: Advanced surgical techniques and equipment.
6
+ 3. Alternate condition: Lack of appropriate medical facilities.
7
+ ### Only text is visible.
8
+ #### Output:
9
+ 1. The goal that the surgeon is trying to achieve is to successfully repair Raquel's knee injury so he can return to playing soccer.
10
+ 2. A condition that is necessary for goal completion is that the few scattered spectators must not interfere or disrupt the surgeon's work during the surgery.
11
+ 3. An alternate condition that will make the goal unlikely to happen is if the few scattered spectators interrupt or distract the surgeon during the surgery, causing a mistake or complication.
12
+ ### Only image is visible.
13
+ #### Output:
14
+ The images you've provided depict a sports stadium with spectators in the stands, and there is no explicit connection to a surgeon or a narrative context involving surgery. However, to engage with the exercise, let's invent a hypothetical storyline.
15
+
16
+ 1. Identify a goal that the agent in the story is trying to achieve.
17
+ Goal: The surgeon's goal is to provide immediate medical aid to injured players on the field.
18
+
19
+ 2. Identify and write a condition that is necessary for goal completion. The condition should be related to the entity.
20
+ Condition: A necessary condition for the goal to be completed is that the few scattered spectators include off-duty medical personnel who can assist the surgeon in administering medical aid quickly.
21
+
22
+ 3. Write an alternate condition that will make the goal unlikely to happen. It is likely that this alternate condition will contradict information provided in the images.
23
+ Alternate condition: The goal would be unlikely to happen if the scattered spectators are not medically trained and panic in the event of an emergency, causing chaos and impeding the surgeon's ability to reach the injured player in a timely manner.
24
+ "