monsoon-nlp commited on
Commit
e99637b
·
1 Parent(s): 686b810

remove deleted post, add evaluation script and score

Browse files
Files changed (3) hide show
  1. README.md +20 -5
  2. dataset.csv +2 -8
  3. eval_openai.py +77 -0
README.md CHANGED
@@ -15,8 +15,8 @@ On the OUTFITS subreddit, users frequently post multiple images and ask commente
15
  This evaluation collects the top two comments and their relative scores (for example, if there is overwhelming support for
16
  one option over another, your evaluation should score differently from a close match).
17
 
18
- The first and second images in the "images" field are the top and secondary images. You should shuffle them before evaluating. <br/>
19
- If there is overwhelming support for the top choice, the second choice will be arbitrary and given 1 vote.
20
 
21
  ## Standards and Practices
22
 
@@ -38,11 +38,26 @@ If there is overwhelming support for the top choice, the second choice will be a
38
 
39
  ## Code
40
 
41
- Python script preparing /r/OUTFITS posts for a multimodal evaluation: scraper.py
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  ### Dependencies
44
 
 
45
  Requires a Reddit app_id, secret, and user_agent saved in `.env` in JSON format. See https://praw.readthedocs.io/en/stable/getting_started/quick_start.html
 
46
 
47
- Pip install:
48
- - praw
 
15
  This evaluation collects the top two comments and their relative scores (for example, if there is overwhelming support for
16
  one option over another, your evaluation should score differently from a close match).
17
 
18
+ The first and second images in the "images" field are the best and second-best images. We shuffle them before evaluating. <br/>
19
+ If there is overwhelming support for the top choice, the second-best will be arbitrary and given 1 vote.
20
 
21
  ## Standards and Practices
22
 
 
38
 
39
  ## Code
40
 
41
+ Python script preparing /r/OUTFITS posts for dataset: scraper.py
42
+
43
+ Python script testing OpenAI's o4-mini model:
44
+
45
+ ## Evaluation Scores
46
+
47
+ Currently scoring by:
48
+ - `1` point for best choice
49
+ - `secondChoice/firstChoiceVotes` for second-best choice
50
+ - 0 points for other options
51
+
52
+ OpenAI's **o4-mini: 8.875 / 12**
53
+
54
+ With more options we should be able to break down scores by M/F/NB flair.
55
 
56
  ### Dependencies
57
 
58
+ For adding to evaluation set:<br/>
59
  Requires a Reddit app_id, secret, and user_agent saved in `.env` in JSON format. See https://praw.readthedocs.io/en/stable/getting_started/quick_start.html
60
+ - praw
61
 
62
+ For evaluating with OpenAI:<br/>
63
+ - openai
dataset.csv CHANGED
@@ -1,22 +1,16 @@
1
  post_id,gender_flair,title,selftext,images,firstChoiceVotes,secondChoice
2
  1m7t7m3,M,Which outfit translates who I am the most?,Need some advice on my style and what to do to take it to the next level,"https://preview.redd.it/vha2f75omqef1.jpg?width=1152&format=pjpg&auto=webp&s=0be961938f64c2a93b0908c7ceab929687ddc0ef,https://preview.redd.it/r5w6wp5omqef1.jpg?width=1152&format=pjpg&auto=webp&s=1fb970b3efba6ea3962a57963157c9d417acbf27,https://preview.redd.it/2ai7ka6omqef1.jpg?width=3060&format=pjpg&auto=webp&s=1213725f563ea6414907abddee965ad6fe3f57a1,https://preview.redd.it/6nasl67omqef1.jpg?width=1080&format=pjpg&auto=webp&s=bef426fcb7d707506899ec6712f073e95da5a17c",17,14
3
- 1m9vff2,F,Birthday night out outfit for over 40°C (105°F),"Please help me pick one of these, I need to go out in a couple of hours. Also, I would really appreciate any suggestions on how to accessorize them. When wearing dresses I don't usuallt do anything extra with the outfit, especially when it's this warm outside.
4
-
5
- I'm leaning towards the blue one, I think it looks a lot better in person and the material feels nice.
6
-
7
- The last time I went out on my birthday was over 10 years ago, so I might be overthinking this","https://preview.redd.it/upbxjwhgg8ff1.jpg?width=1838&format=pjpg&auto=webp&s=44239f75ab57ce97b95a02fe0c463b5cc2648f15,https://preview.redd.it/b90krxbgg8ff1.jpg?width=2092&format=pjpg&auto=webp&s=fe7a0e7caeffd677d26238ae829def447e6aa85d,https://preview.redd.it/76audxufg8ff1.jpg?width=1604&format=pjpg&auto=webp&s=f1ddc5bad185e116192e5145efc47071f80603fe,https://preview.redd.it/r6thf64gg8ff1.jpg?width=2006&format=pjpg&auto=webp&s=e8bddb5a3d91936bcf3c828490b49516275cc833",21,19
8
  1m99giq,F,"Used to live in black, now I’m embracing color. Which one works best?",All summer outfits ,"https://preview.redd.it/ujs3myelu2ff1.jpg?width=1284&format=pjpg&auto=webp&s=a996d416c0ef2890ada32e81b1c0e6bd56965bf4,https://preview.redd.it/nnpie0glu2ff1.jpg?width=895&format=pjpg&auto=webp&s=ae738d2f212f8f341b232856b75e366091d42cd7,https://preview.redd.it/r2dol8flu2ff1.jpg?width=2247&format=pjpg&auto=webp&s=0383f99f58d8ea9ba96fd4d492ac46dc0b52ee2c,https://preview.redd.it/sr9vt0glu2ff1.jpg?width=1284&format=pjpg&auto=webp&s=02e2e7e080fff0e170c92267f9000a7d67eeb636",17,11
9
  1m6tbon,F,Tomorrow night there's a themed BYOB by the water! Which one?,"Okay, so the first picture is my normal style. Like casual but cute? Idek. Lol. Tomorrow night my friends and I are going to a down by the water themed tropical/floral painting night. They always dress super cute and I'm more comfortable in casual outfits but, want to try. Which one 😬 I'm not into fashion at all! ","https://preview.redd.it/leshndafdief1.jpg?width=1250&format=pjpg&auto=webp&s=b7b025c09872c33f5b82ffa98335e58f6354330d,https://preview.redd.it/cuwmwacfdief1.jpg?width=1137&format=pjpg&auto=webp&s=5e567c7c247e9017b9fe7518391aa111d98842b8,https://preview.redd.it/snmqh76fdief1.jpg?width=819&format=pjpg&auto=webp&s=00c8a01b184458150b1a46ed56ca88a67fcfdf75,https://preview.redd.it/l9okfcvedief1.jpg?width=1001&format=pjpg&auto=webp&s=a8ad9dd077032cbf7f72876e43c6c34fc9303559",59,51
10
  1m6gp2q,F,Outfit Help?!?!,Please help. I cannot figure out what to wear to a get together tomorrow. I’m very insecure about my body and feel like I look gross in everything. We’re going to a casual bar in an urban suburb for context. Please ignore my unmade bed lol. I have another outfit that I’m thinking and just haven’t taken a picture of myself in it. It’s like pink shorts with a black top. TIA. Please be nice 💕,"https://preview.redd.it/3o7tmv42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=2446126483ada4afa8d221cabb6c7e5d17e52e12,https://preview.redd.it/k559mw42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=95e497f59e223f823a90df448cca20140d4c865a,https://preview.redd.it/l9fxyu42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=c7c18c161ebd09c59958f8a7119883a220d48e6e,https://preview.redd.it/905juv42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=7412efcbfe38ffdd69dd3e45070be009fd142c39",7,4
11
  1m5z07q,F,Birthday Brunch Fit…What are we feeling?,"Sweet, Sporty, or a little Sultry perhaps? ","https://preview.redd.it/ud8u1n3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=8cab062a702472b135478eb0f49a946c68e9d7e7,https://preview.redd.it/iem1vk3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=f3d7cb079e2cce883d3fc3aedee6ee45fc5cfd96,https://preview.redd.it/c23h8n3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=386e1fdb74ea6212f3091380e4e7050a226cef89",80,59
12
  1m8bbal,F,Help which skirt looks better," the maxi one make me look thinner but it it is too heavy
13
  The draped one is more fun but I feel it make me look short ","https://preview.redd.it/90aufgmo1vef1.jpg?width=905&format=pjpg&auto=webp&s=e31e15c72e4348e89e4c2dcb2952ad0fc85c084a,https://preview.redd.it/yo3cjgmo1vef1.jpg?width=439&format=pjpg&auto=webp&s=fb6518c3b4f4876c5cce40accceb7de88720990d",203,1
14
-
15
  1m42jjy,M,Going to a concert. Which one looks better?,I’m still learning to dress better. Please be nice. ,"https://preview.redd.it/0qp2rsvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=b3bcce5ee2dc8abeb312d1e167da5b8ddd1c827b,https://preview.redd.it/m9gh6tvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=7ab5f371ac8bb871a5eaa68b7fc09fd1677a3e81,https://preview.redd.it/6qovckvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=352c55e9a263fbf7d6d12c7495c6a2c534b8ffcb",769,1
16
  1m3wjde,F,All similar but which is actually best? 💙,,"https://preview.redd.it/ce9v978c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=8d8b0d92ec06e4acbd9b1b2c3174b60365e373e0,https://preview.redd.it/821xm68c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=a64009ed305381435b1ca09e6fea86aa11abd58e,https://preview.redd.it/1v4b578c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=706a0108caa78b73c68bc407283a05bc49f6cf05",276,196
17
  1ls9ozg,F,Upscale dinner outfit pt 2?,"After everyone unanimously voted for the black strapless dress, I went digging in my closet a bit more for .. less casual dresses (old habits die hard). Are we still team strapless black dress? Or red or pink?","https://preview.redd.it/8ii26pra32bf1.jpg?width=2829&format=pjpg&auto=webp&s=478af8f62e81cb6dc997b819e1284e3cfd49ec2b,https://preview.redd.it/h1okmnra32bf1.jpg?width=2234&format=pjpg&auto=webp&s=f6e1cff51c0953d5cff3981f633b8c4c4e84c632,https://preview.redd.it/c6a5sora32bf1.jpg?width=2290&format=pjpg&auto=webp&s=c4c10927b303b1e1d038b27e4ad8d7180c49fa00",667,1
18
- 1lrzbuu,F,Dress for upscale dinner,"Thank you all for your help on my last post! It gave me the clarity I needed to not purchase the dress (and save money)!
19
-
20
  I need y’all’s advice one more time. I have a birthday dinner tomorrow for a friend and need help deciding between three dresses: pink, black, or blue? Thank you!","https://preview.redd.it/ixdvxxhotyaf1.jpg?width=2290&format=pjpg&auto=webp&s=c58ff4266be2cd3b5b2b9b9f1a46cb0066685dee,https://preview.redd.it/22idq6hotyaf1.jpg?width=1576&format=pjpg&auto=webp&s=6f3210d343c6815b7c48846cde04f2fd940a43c0,https://preview.redd.it/q4tpkehotyaf1.jpg?width=3308&format=pjpg&auto=webp&s=c81c4c459e0285bc7f0611aa56aa984fc2001e9a",296,1
21
  1mahdjd,F,1 or 2?,,"https://preview.redd.it/590sl6u8qdff1.jpg?width=1153&format=pjpg&auto=webp&s=9ca7e99db5939b3ff19156f23c5f21d1f76fdd6c,https://preview.redd.it/3elbnzo8qdff1.jpg?width=1152&format=pjpg&auto=webp&s=273abc4b4ea9ca961f2ba9a6b6d5f7c569ff42ba",73,38
22
  1may7gl,F,"I love sundresses, which one looks better 1,2,3, or 4?",,"https://preview.redd.it/501qbxdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=8bc9049fe684e5c71d52adcd57ab31901ad20450,https://preview.redd.it/fi51hwdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=d2ab426c0ed23c499ab6b304a25b7c2a81760ce5,https://preview.redd.it/ap8fyvdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=393a07212bd829e8022636cd6aec4ba53a6fe2f6,https://preview.redd.it/t0zdxvdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=4977f3e928fa80ed4feff4f2d22f92e50f246ec7",41,32
 
1
  post_id,gender_flair,title,selftext,images,firstChoiceVotes,secondChoice
2
  1m7t7m3,M,Which outfit translates who I am the most?,Need some advice on my style and what to do to take it to the next level,"https://preview.redd.it/vha2f75omqef1.jpg?width=1152&format=pjpg&auto=webp&s=0be961938f64c2a93b0908c7ceab929687ddc0ef,https://preview.redd.it/r5w6wp5omqef1.jpg?width=1152&format=pjpg&auto=webp&s=1fb970b3efba6ea3962a57963157c9d417acbf27,https://preview.redd.it/2ai7ka6omqef1.jpg?width=3060&format=pjpg&auto=webp&s=1213725f563ea6414907abddee965ad6fe3f57a1,https://preview.redd.it/6nasl67omqef1.jpg?width=1080&format=pjpg&auto=webp&s=bef426fcb7d707506899ec6712f073e95da5a17c",17,14
 
 
 
 
 
3
  1m99giq,F,"Used to live in black, now I’m embracing color. Which one works best?",All summer outfits ,"https://preview.redd.it/ujs3myelu2ff1.jpg?width=1284&format=pjpg&auto=webp&s=a996d416c0ef2890ada32e81b1c0e6bd56965bf4,https://preview.redd.it/nnpie0glu2ff1.jpg?width=895&format=pjpg&auto=webp&s=ae738d2f212f8f341b232856b75e366091d42cd7,https://preview.redd.it/r2dol8flu2ff1.jpg?width=2247&format=pjpg&auto=webp&s=0383f99f58d8ea9ba96fd4d492ac46dc0b52ee2c,https://preview.redd.it/sr9vt0glu2ff1.jpg?width=1284&format=pjpg&auto=webp&s=02e2e7e080fff0e170c92267f9000a7d67eeb636",17,11
4
  1m6tbon,F,Tomorrow night there's a themed BYOB by the water! Which one?,"Okay, so the first picture is my normal style. Like casual but cute? Idek. Lol. Tomorrow night my friends and I are going to a down by the water themed tropical/floral painting night. They always dress super cute and I'm more comfortable in casual outfits but, want to try. Which one 😬 I'm not into fashion at all! ","https://preview.redd.it/leshndafdief1.jpg?width=1250&format=pjpg&auto=webp&s=b7b025c09872c33f5b82ffa98335e58f6354330d,https://preview.redd.it/cuwmwacfdief1.jpg?width=1137&format=pjpg&auto=webp&s=5e567c7c247e9017b9fe7518391aa111d98842b8,https://preview.redd.it/snmqh76fdief1.jpg?width=819&format=pjpg&auto=webp&s=00c8a01b184458150b1a46ed56ca88a67fcfdf75,https://preview.redd.it/l9okfcvedief1.jpg?width=1001&format=pjpg&auto=webp&s=a8ad9dd077032cbf7f72876e43c6c34fc9303559",59,51
5
  1m6gp2q,F,Outfit Help?!?!,Please help. I cannot figure out what to wear to a get together tomorrow. I’m very insecure about my body and feel like I look gross in everything. We’re going to a casual bar in an urban suburb for context. Please ignore my unmade bed lol. I have another outfit that I’m thinking and just haven’t taken a picture of myself in it. It’s like pink shorts with a black top. TIA. Please be nice 💕,"https://preview.redd.it/3o7tmv42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=2446126483ada4afa8d221cabb6c7e5d17e52e12,https://preview.redd.it/k559mw42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=95e497f59e223f823a90df448cca20140d4c865a,https://preview.redd.it/l9fxyu42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=c7c18c161ebd09c59958f8a7119883a220d48e6e,https://preview.redd.it/905juv42zfef1.jpg?width=1576&format=pjpg&auto=webp&s=7412efcbfe38ffdd69dd3e45070be009fd142c39",7,4
6
  1m5z07q,F,Birthday Brunch Fit…What are we feeling?,"Sweet, Sporty, or a little Sultry perhaps? ","https://preview.redd.it/ud8u1n3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=8cab062a702472b135478eb0f49a946c68e9d7e7,https://preview.redd.it/iem1vk3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=f3d7cb079e2cce883d3fc3aedee6ee45fc5cfd96,https://preview.redd.it/c23h8n3qebef1.jpg?width=3024&format=pjpg&auto=webp&s=386e1fdb74ea6212f3091380e4e7050a226cef89",80,59
7
  1m8bbal,F,Help which skirt looks better," the maxi one make me look thinner but it it is too heavy
8
  The draped one is more fun but I feel it make me look short ","https://preview.redd.it/90aufgmo1vef1.jpg?width=905&format=pjpg&auto=webp&s=e31e15c72e4348e89e4c2dcb2952ad0fc85c084a,https://preview.redd.it/yo3cjgmo1vef1.jpg?width=439&format=pjpg&auto=webp&s=fb6518c3b4f4876c5cce40accceb7de88720990d",203,1
 
9
  1m42jjy,M,Going to a concert. Which one looks better?,I’m still learning to dress better. Please be nice. ,"https://preview.redd.it/0qp2rsvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=b3bcce5ee2dc8abeb312d1e167da5b8ddd1c827b,https://preview.redd.it/m9gh6tvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=7ab5f371ac8bb871a5eaa68b7fc09fd1677a3e81,https://preview.redd.it/6qovckvkdvdf1.jpg?width=3024&format=pjpg&auto=webp&s=352c55e9a263fbf7d6d12c7495c6a2c534b8ffcb",769,1
10
  1m3wjde,F,All similar but which is actually best? 💙,,"https://preview.redd.it/ce9v978c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=8d8b0d92ec06e4acbd9b1b2c3174b60365e373e0,https://preview.redd.it/821xm68c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=a64009ed305381435b1ca09e6fea86aa11abd58e,https://preview.redd.it/1v4b578c4udf1.jpg?width=3024&format=pjpg&auto=webp&s=706a0108caa78b73c68bc407283a05bc49f6cf05",276,196
11
  1ls9ozg,F,Upscale dinner outfit pt 2?,"After everyone unanimously voted for the black strapless dress, I went digging in my closet a bit more for .. less casual dresses (old habits die hard). Are we still team strapless black dress? Or red or pink?","https://preview.redd.it/8ii26pra32bf1.jpg?width=2829&format=pjpg&auto=webp&s=478af8f62e81cb6dc997b819e1284e3cfd49ec2b,https://preview.redd.it/h1okmnra32bf1.jpg?width=2234&format=pjpg&auto=webp&s=f6e1cff51c0953d5cff3981f633b8c4c4e84c632,https://preview.redd.it/c6a5sora32bf1.jpg?width=2290&format=pjpg&auto=webp&s=c4c10927b303b1e1d038b27e4ad8d7180c49fa00",667,1
12
+ 1lrzbuu,F,Dress for upscale dinner,"Thank you all for your help on my last post! It gave me the clarity I needed to not purchase the dress (and save money)!
13
+
14
  I need y’all’s advice one more time. I have a birthday dinner tomorrow for a friend and need help deciding between three dresses: pink, black, or blue? Thank you!","https://preview.redd.it/ixdvxxhotyaf1.jpg?width=2290&format=pjpg&auto=webp&s=c58ff4266be2cd3b5b2b9b9f1a46cb0066685dee,https://preview.redd.it/22idq6hotyaf1.jpg?width=1576&format=pjpg&auto=webp&s=6f3210d343c6815b7c48846cde04f2fd940a43c0,https://preview.redd.it/q4tpkehotyaf1.jpg?width=3308&format=pjpg&auto=webp&s=c81c4c459e0285bc7f0611aa56aa984fc2001e9a",296,1
15
  1mahdjd,F,1 or 2?,,"https://preview.redd.it/590sl6u8qdff1.jpg?width=1153&format=pjpg&auto=webp&s=9ca7e99db5939b3ff19156f23c5f21d1f76fdd6c,https://preview.redd.it/3elbnzo8qdff1.jpg?width=1152&format=pjpg&auto=webp&s=273abc4b4ea9ca961f2ba9a6b6d5f7c569ff42ba",73,38
16
  1may7gl,F,"I love sundresses, which one looks better 1,2,3, or 4?",,"https://preview.redd.it/501qbxdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=8bc9049fe684e5c71d52adcd57ab31901ad20450,https://preview.redd.it/fi51hwdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=d2ab426c0ed23c499ab6b304a25b7c2a81760ce5,https://preview.redd.it/ap8fyvdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=393a07212bd829e8022636cd6aec4ba53a6fe2f6,https://preview.redd.it/t0zdxvdkjhff1.jpg?width=1170&format=pjpg&auto=webp&s=4977f3e928fa80ed4feff4f2d22f92e50f246ec7",41,32
eval_openai.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import openai
3
+ import os
4
+ import random
5
+ import re
6
+
7
+ # consistent use
8
+ random.seed(1929)
9
+
10
+ # get an OpenAI API key and `export OPENAI_API_KEY=sk---`
11
+ client = openai.OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
12
+ model = "o4-mini"
13
+
14
+ # dynamic list length returning "1, 2, or 3"; "1 or 2"
15
+ def natural_enum(n: int) -> str:
16
+ nums = [str(i) for i in range(1, n + 1)]
17
+ if n == 1:
18
+ return nums[0]
19
+ return ", ".join(nums[:-1]) + f", or {nums[-1]}"
20
+
21
+ def shuffle_with_index_tracking(images, best_index=0, second_index=1):
22
+ copy = [i for i in images]
23
+ random.shuffle(copy)
24
+ return copy, copy.index(images[0]), copy.index(images[1])
25
+
26
+ def ask_openai_best_outfit(post, images):
27
+ image_messages = [
28
+ {
29
+ "type": "input_image",
30
+ "image_url": url
31
+ } for url in images
32
+ ]
33
+
34
+ prompt = (
35
+ "You're a fashion-savvy assistant. Here are images of different outfits. "
36
+ f"{post['title']} {post['selftext']} "
37
+ f"Respond only with the number of the best outfit: {natural_enum(len(images))}."
38
+ )
39
+
40
+ try:
41
+ response = client.responses.create(
42
+ model=model,
43
+ input=[
44
+ {"role": "user", "content": [
45
+ {"type": "input_text", "text": prompt},
46
+ *image_messages
47
+ ]}
48
+ ],
49
+ )
50
+ except openai.BadRequestError as e:
51
+ raise Exception("There is an issue possibly retrieving images for the post. It might have been deleted?")
52
+
53
+
54
+ # for this model, output[0] is any reasoning
55
+ text = response.output[1].content[0].text
56
+ match = re.search(r"\d+", text)
57
+ if match is not None:
58
+ return int(match[0])
59
+ raise ValueError(f"Invalid response: {text}")
60
+
61
+ posts = csv.DictReader(open('./dataset.csv', 'r'))
62
+ score = 0.0
63
+ items = 0
64
+ for post in posts:
65
+ items += 1
66
+ print(post['title'])
67
+ shuffled_images, best_after_shuffle, second_after_shuffle = shuffle_with_index_tracking(post["images"].split(","))
68
+ # print(f"{len(shuffled_images)} options")
69
+
70
+ # this subtracts 1 so AI returning "1" is the 0th image
71
+ predicted_index = ask_openai_best_outfit(post, shuffled_images) - 1
72
+
73
+ if predicted_index == best_after_shuffle:
74
+ score += 1.0
75
+ elif predicted_index == second_after_shuffle:
76
+ score += float(post["secondChoice"]) / float(post["firstChoiceVotes"])
77
+ print(f"Total score: {score}/{items}")